Lolly
Buksan ang App

Colour in the engine

This page is for tool authors and anyone checking why an exported colour looks the way it does. It covers three separate questions: which colours Lolly can read, where its colour maths happens and which colour spaces it writes. For choosing an export format and its colour profile, see Export a file.

One module, engine/src/css-color.ts, parses, converts, gamut-maps and writes colour for the whole platform, so the browser preview and every export walker agree on what a colour string means.

Reading

Wherever a colour is written (a tool's stylesheet, an imported SVG's paint, a design token's value, a shadow or gradient inside a CSS shorthand), Lolly reads the full CSS Color 4 vocabulary:

This matters because a browser resolves modern CSS into modern CSS. A color-mix(in oklab, …) computes to oklab(…), and a brand token stored as oklch() reaches the export walker in that form. Both are read as colours rather than dropped. A value the parser cannot read returns "no colour" instead of failing the render, because imported documents are untrusted input.

Thinking

Colour maths happens perceptually rather than in raw channels.

One interpolator serves the preview and the export walkers, so a gradient is blended the same way on screen and in the file.

Writing

The output is narrower than the input, because a file has to be readable by any app that opens the file. A space is declared on output only when the numbers were really converted into that space.

OutputWritten as
Screen and web formatssRGB, tagged as sRGB
Print formatsCMYK against a named press condition
The export panel's HDR cardRec.2100 PQ

A wide-gamut colour that reaches an ordinary export is mapped into sRGB rather than mislabelled. A Design document set to Wide colour / HDR works differently: it keeps its wider swatches and float pixels through its own raster and video exports, as Wide colour and HDR editing describes.

A gradient authored in OKLab is baked into plain sRGB stops on the way out. Extra stops are inserted only where sRGB would visibly drift from the perceptual curve, because an SVG <linearGradient> and a PDF axial shading have no setting for the interpolation space. One authored value gives the same gradient in the preview, the SVG and the PDF.

Where to look in the code

ConcernModule
Parsing, conversion, interpolation, gradient bakingengine/src/css-color.ts
OKLab and OKLCH maths, gamut mappingengine/src/brand-derive.ts
Ramps for palettes and gradient tokensengine/src/color-tools.ts (rampOklab)
ICC profile bytes and press conditionsengine/src/color.ts
Colours read out of SVG paintengine/src/svg-colors.ts