-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
Summary
Migrate the design token color system from HEX values to OKLCH color format for perceptually uniform colors, better dynamic theming, and wider gamut (P3) display support.
Motivation
- Perceptual uniformity — equal numeric changes in OKLCH produce equal visual changes, unlike HEX/RGB
- Better dark mode authoring — the lightness channel makes light↔dark palette mapping more predictable and systematic
- Wider gamut — natively supports P3 displays without fallback hacks
- Dynamic theming — programmatic adjustments to L (lightness), C (chroma), or H (hue) produce consistent, predictable results
Scope
Primitive tokens (main effort)
Convert all HEX values to oklch() in:
packages/raystack/styles/primitives/gray.css— 4 gray palettes × 12 steps × 2 themespackages/raystack/styles/primitives/accent.css— 3 accent palettes × 13 steps × 2 themespackages/raystack/styles/primitives/appearance.css— semantic primitives (neutral, danger, attention, success) × 2 themes- Visualization colors — 14 palettes × 12 steps × 2 themes
Overlay tokens
Convert HEX+alpha overlays to OKLCH alpha syntax:
/* before */
--rs-color-overlay-black-a6: #00000080;
/* after */
--rs-color-overlay-black-a6: oklch(0 0 0 / 50%);ColorPicker component
- Update
packages/raystack/components/color-picker/utils.tsto support OKLCH as a color mode - Replace or supplement the
colornpm package (no OKLCH support) withculoriorcolorjs.io
Documentation
- Update
apps/www/src/content/docs/theme/colors/index.mdxwith OKLCH format references
No component changes needed
Components consume semantic CSS variables (var(--rs-color-...)), so no component CSS files need modification.
Approach
- Write a conversion script using
culoriorcolorjs.ioto batch-convert HEX → OKLCH - Convert primitive token files (
gray.css,accent.css,appearance.css) - Convert overlay tokens
- Run visual regression tests to catch any perceptual shifts
- Update ColorPicker to support OKLCH mode
- Update docs
Browser Support
OKLCH is supported in all modern browsers (Chrome 111+, Firefox 113+, Safari 15.4+). If older browser support is required, provide HEX fallbacks using CSS cascade:
--rs-gray-1: #fcfcfc;
--rs-gray-1: oklch(0.993 0.001 264);References
Reactions are currently unavailable