Color

A colour from a block's color primitive variable type.

A colour from a block's color primitive variable type. The value is either a custom RGBA colour or a reference to a theme palette swatch.

Properties

alpha

The alpha (opacity) channel of the colour.

Returns: Float — The alpha component of the colour; a decimal number between 0.0 and 1.0.

blue

The blue channel of the colour.

Returns: Integer — The blue component of the colour; a number between 0 and 255.

green

The green channel of the colour.

Returns: Integer — The green component of the colour; a number between 0 and 255.

hex

The hex representation of the colour, e.g. #0066ff. Opacity is not included; prefer rgba when the colour may have transparency.

Returns: String or nil — nil when no colour value is set.

red

The red channel of the colour.

Returns: Integer — The red component of the colour; a number between 0 and 255.

rgba

The colour as an rgba(...) CSS value, e.g. rgba(0, 102, 255, 0.3).

Returns: String or nil — nil when no colour value is set.

to_s

String representation of the colour; equivalent to hex.

Returns: String or nil — nil when no colour value is set.

On this page