Color
A resolved color value.
Variants preserve the source form an author wrote so re-serialization round-trips back to the same JSON shape (e.g. "red" parsed via the named-color table becomes Hex, whose canonical encoding is #rrggbb; an explicit "rgba(...)" stays an Rgba). All variants expose 0..255 channel ints so consumers (renderers, converters) never need to re-parse.
Supported source forms at decode time: #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(r, g, b), rgba(r, g, b, a), and the 140 CSS Color Module 3 names + transparent. Anything else (e.g. hsl(...)) throws a SerializationException.
Inheritors
Types
Link copied to clipboard
data class ColorFunction(val space: Color.ColorFunction.Space, val c1: Double, val c2: Double, val c3: Double, val alphaFraction: Double = 1.0) : Color
color(<space> c1 c2 c3 / α) for the sRGB-family color spaces. Channels are 0..1 floats; out-of-gamut values are clipped after any required gamma encoding.
Link copied to clipboard
Link copied to clipboard