Color

The Color type is a tagged union that can hold one color in a CSS-defined colorspace. This correspond to both "specified", "computed", and "used" colors in CSS specification. In typical use, you'll want to map to sRGB 32-bit RGBA quadruplet, and the function for this is called: toRGBA8(). Reference: https://www.w3.org/TR/css-color-4/

Constructors

this
this(const(char)[] cssColor)

Build from CSS color string.

this
this(RGBA8 c)

Build from a 8-bit sRGB quadruplet.

this
this(RGBA16 c)

Build from a 16-bit sRGB quadruplet.

this
this(RGBAf c)

Build from a 32-bit float sRGB quadruplet.

Members

Functions

assumeColorspace
void assumeColorspace(Colorspace colorspace)

Unsafe cast of colorspace. Normally you never need this.

colorspace
Colorspace colorspace()

Get colorspace tag. This is the tag of this tagged union.

toRGBA16
RGBA16 toRGBA16()
toRGBA8
RGBA8 toRGBA8()
toRGBAf
RGBAf toRGBAf()

A 32-bit float normalized tristimulus sRGB color, with alpha.

Unions

__anonymous
union __anonymous
Undocumented in source.

Meta