Colour
References[IoId("00000000-c3b4-48fe-9367-bb4402cf6471")]
public sealed class Colour : IStorable, IEquatable<Colour>
Provides a way to store colours using a variety of spaces using high-precision mathematics. This is the class Grasshopper uses internally to store colours. Rhino, Eto, and .NET have their own colour types (usually ColorRGBA, Color, and Color, but there are many more), so you may need to convert to and from those types to Colour on a per-case basis.
Constructors
Fields
Properties
Indexers
Methods
FromCmy
#Create a new CMY colour.
FromHsl
#Create a new HSL colour.
FromHsp
#Create a new H*SP colour.
FromHsv
#Create a new HSV (HSB) colour.
FromLab
#Create a new Cie Yxy colour.
FromOklab
#Create a new Oklab colour.
FromOklch
#Create a new Oklab colour from its polar Oklch form.
FromRgb
#Create a new sRGB colour.
FromRgbLinear
#Create a new linear RGB colour.
FromXyz
#Create a new Cie XYZ colour.
FromYxy
#Create a new Cie Yxy colour.
ToNamedString
#Returns the name of this colour, or a description of its channels. The name is only returned if this colour is defined in sRGB.
ToNamedString
#Returns the name of this colour, or a description of its channels. The name is only returned if this colour is defined in sRGB.
Parameters:
| palettes (params NamedPalette[]) |
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| Colour | + | Colour | Colour | Add two colours in the Linear RGB space. |
| Colour | + | double | Colour | Add two colours in the Linear RGB space. |
| double | + | Colour | Colour | Add two colours in the Linear RGB space. |
| Colour | / | Colour | Colour | Divide two colours in the Linear RGB space, which is actually the Screen blending mode. |
| Colour | / | double | Colour | Divide two colours in the Linear RGB space, which is actually the Screen blending mode. |
| double | / | Colour | Colour | Divide two colours in the Linear RGB space, which is actually the Screen blending mode. |
| Colour | == | Colour | bool | Test for equality. |
| Colour | != | Colour | bool | Test for inequality. |
| Colour | * | Colour | Colour | Multiply two colours in the Linear RGB space. |
| Colour | * | double | Colour | Multiply two colours in the Linear RGB space. |
| double | * | Colour | Colour | Multiply two colours in the Linear RGB space. |
| Colour | - | Colour | Colour | Subtract two colours in the Linear RGB space. |
| Colour | - | double | Colour | Subtract two colours in the Linear RGB space. |
| double | - | Colour | Colour | Subtract two colours in the Linear RGB space. |
| - | Colour | Colour | Negate a colour in the Linear RGB space. | |