Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

COLOUR_PACKAGE

const COLOUR_PACKAGE: IEnginePackage;

Defined in: packages/engine/src/packages/colour/ColourPackage.ts:41

Colours as first-class values: #ff0000 hex literals, rgb()/hsl() and CSS named colours via color("..."), and the DevTools-style adjusters (lighten, darken, rotate, mix, contrast, …). A colour result carries its channels and a render-ready CSS string across the worker boundary so a host can draw a swatch. See ColourMath.ts for the maths.

The #hex literal is recognised by the core lexer (it has to disambiguate # from a markdown heading/comment); this package supplies the parselet that turns the resulting HEX_COLOUR token into a colour. Function names are fused only when immediately called, so mix/rotate/alpha stay usable as variables.