disko:color
Mix, lighten, darken and fade colours made with rgb, rgba, hsl and hsla.
Import with import { mix } from "disko:color". Generated from the module's
shipped declarations. Colours themselves come from the
colour functions; see
Drawings for a guide.
disko:color — working with colours: mixing, lightening, darkening and changing transparency.
Colours are the frozen { r, g, b, a } values that the rgb, rgba, hsl and hsla globals make. Every function returns a new colour, accepted wherever a colour is: drawings, UI styles and chat.
Mistakes throw where they are made: TypeError for a value that is not a colour, RangeError for an amount or alpha outside 0–1.
Functions
mix
The colour t of the way from from to to, alpha included.
lighten
color moved by (0–1) of the way toward white.
darken
color moved by (0–1) of the way toward black.
withAlpha
color with alpha a, from 0 (clear) to 1 (opaque).