Colors
Eight helpers for deriving one colour from another, so a theme can state a relationship instead of a hex code.
| Function | Does |
|---|---|
lighten | raises lightness |
darken | lowers lightness |
saturate | raises saturation |
adjustHue | rotates hue |
alpha | sets opacity |
mix | blends two colours |
contrast | contrast between two colours |
tokenAccessor | reads a token back out |
Why derive rather than hardcode
A theme built from seven literal hex values has seven independent
things to keep consistent. One built from a base colour plus lighten,
darken, and mix has one, and the relationships survive a change to the base.
contrast is the one that checks rather than produces — reach for it when a
derived colour has to stay readable against its background, instead of eyeballing
the result.
Where they belong
These are theme-authoring helpers. They compute values; they do not register
anything. The registration is theme().