Modules · Interface · Colour
RGB colours and blending. Colour models a colour as red, green, blue, and alpha channels from 0.0 to 1.0 — the Colour value type, which doubles as a namespace holding a palette of named colour constants plus channel-wise arithmetic, lightening and darkening, clamping, interpolation and blend helpers. Every operation is reactive, recomputing whenever a colour it reads changes.
A colour as red, green, blue, and alpha (opacity) channels from 0.0 to 1.0. It also groups the colour constants and operations.
The predefined black colour.
The predefined blue colour.
The predefined brown colour.
The predefined cyan colour.
The predefined green colour.
Preset grey shade 1 of nine, from dark to light.
Preset grey shade 2 of nine, from dark to light.
Preset grey shade 3 of nine, from dark to light.
Preset grey shade 4 of nine, from dark to light.
Preset grey shade 5 of nine, from dark to light.
Preset grey shade 6 of nine, from dark to light.
Preset grey shade 7 of nine, from dark to light.
Preset grey shade 8 of nine, from dark to light.
Preset grey shade 9 of nine, from dark to light.
The predefined magenta colour.
The predefined orange colour.
The predefined pink colour.
The predefined purple colour.
The predefined red colour.
The predefined white colour.
The predefined yellow colour.
Adds two colours channel by channel.
Returns Colour — the channel-wise sum of the two colours.
Linearly interpolates a single channel value.
Returns Maths.Real — value1 and value2 mixed by factor .
Linearly blends two colours by a factor.
Returns Colour — each channel factor of the way from colour1 to colour2 .
Blends two colours in squared space for a perceptually smoother mix.
Returns Colour — the blend taken after squaring each colour and rooted back afterwards.
Blends two colours in square-root space.
Returns Colour — the blend taken after rooting each colour and squared back afterwards.
Converts a 0.0 to 1.0 channel into a 0-255 byte.
Returns Maths.Integer — value scaled to an integer in the range 0 to 255.
Constrains each channel between a minimum and maximum colour.
Returns Colour — the colour with each channel pulled into the range of the bound colours.
Mixes a colour toward black by a proportion.
Returns Colour — the colour blended toward black by proportion .
Builds a colour, defaulting alpha to fully opaque when omitted.
Returns Colour — the colour, using 1.0 for alpha when optionalAlpha is absent.
Builds a colour from 0-255 byte channel values.
Returns Colour — the colour with each byte scaled into the 0.0 to 1.0 range.
Reads a colour from a JSON object of channels.
Returns Colour — the colour parsed from the JSON, using defaults for missing channels.
Reads a colour from optional JSON, passing absence through.
Returns Collection.Optional(Colour) — the parsed colour, or absent when the input is absent.
A grey with every colour channel set to the same value.
Returns Colour — a grey at the given shade.
Blends two colours channel by channel by a factor.
Mixes a colour toward white by a proportion.
Returns Colour — the colour blended toward white by proportion .
Takes the brighter channel from each of two colours.
Returns Colour — the channel-wise maximum of the two colours.
Takes the darker channel from each of two colours.
Returns Colour — the channel-wise minimum of the two colours.
Multiplies two colours channel by channel.
Returns Colour — the channel-wise product of the two colours.
Squares each channel of a colour.
Returns Colour — the colour with each channel multiplied by itself.
Takes the square root of each channel of a colour.
Returns Colour — the colour with each channel replaced by its square root.
Subtracts one colour from another channel by channel.
Returns Colour — the channel-wise difference of the two colours.
Renders a colour as a semicolon-separated ANSI RGB triplet.
Returns Text — the byte channels joined as r;g;b for an ANSI escape.
Encodes a colour as a JSON object of its channels.
Returns Code.Language.Json.Value — a JSON object holding each channel.