Model - Color functions
Every function callable as Color.* inside an expression — an argument input, a parameter binding, a table cell. Pure: no side effects, no async.
| Function | Returns | Description | Arg | Type | Meaning |
|---|---|---|---|---|---|
Color.alpha(color, value) | string | CSS rgba() string with the given alpha — translucent fills/overlays. | color | color | hex color |
value | number | opacity 0..1 | |||
Color.contrast(background, dark, light) | color | Pick whichever of dark/light reads better on the background (WCAG contrast ratio) — self-adapting text color. | background | color | background hex color |
dark | color | dark candidate (default #111111) | |||
light | color | light candidate (default #ffffff) | |||
Color.darken(color, fraction) | color | Darken toward black. | color | color | hex color |
fraction | number | 0..1 toward black (default 0.1) | |||
Color.hsl(hue, saturation, lightness) | color | Build a hex color from hue/saturation/lightness — the parametric constructor (Color.hsl(index * 30, 0.7, 0.5)). | hue | number | degrees, wraps 360 |
saturation | number | 0..1 (default 0.7) | |||
lightness | number | 0..1 (default 0.5) | |||
Color.lighten(color, fraction) | color | Lighten toward white. | color | color | hex color |
fraction | number | 0..1 toward white (default 0.1) | |||
Color.luminance(color) | number | WCAG relative luminance 0 (black) .. 1 (white) — for conditionals (Color.luminance(brand) > 0.5). | color | color | hex color |
Color.mix(from, to, fraction) | color | Blend two hex colors. | from | color | first hex color |
to | color | second hex color | |||
fraction | number | 0 = all from, 1 = all to (default 0.5) | |||
Color.rgb(red, green, blue) | color | Build a hex color from RGB channels. | red | number | 0..255 |
green | number | 0..255 | |||
blue | number | 0..255 | |||
Color.rotate(color, degrees) | color | Rotate the hue — rotate(brand, 180) is the complement, ±30 gives analogous colors. | color | color | hex color |
degrees | number | hue rotation in degrees, wraps (default 30) | |||
Color.saturate(color, amount) | color | Scale saturation — negative desaturates, -1 is grayscale; grays stay gray. | color | color | hex color |
amount | number | -1..1 multiplicative (-1 = grayscale, +1 = double; default 0.25) |