On this page
oklch()
Prev: `var()` | Up: color | Next: `color-mix()`
Rel: color, Color & Value Functions Guide
Ref: MDN Web Docs — oklch()
Tags: #public #web #css #functions #color #tier/core
Syntax & Overview
oklch(58% 0.18 250 / 0.9)
Perceptually uniform Lightness-Chroma-Hue color space with wide P3 gamut support.
Notes & Best Practices
- Perceptually uniform Lightness-Chroma-Hue: Rotating Hue keeps perceived brightness and WCAG contrast predictable across an entire palette.
- Supports wide P3 gamut displays with automatic sRGB gamut mapping on older screens.
Example
:root {
--accent-blue: oklch(58% 0.18 250);
--accent-teal: oklch(58% 0.18 190); /* same visual lightness! */
}
.badge { background: oklch(58% 0.18 250 / 0.15); color: var(--accent-blue); }
Linked from
Related notes
- tuts/css/functions/color/color-mix Linked here; links to this page; shared tags: #color, #css, #functions, #tier, #web
- tuts/css/functions/color/var Linked here; links to this page; shared tags: #color, #css, #functions, #tier, #web
- tuts/css/functions/color Linked here; links to this page; shared tags: #color, #css, #functions, #web
- tuts/css/functions/color_and_value_functions Linked here; shared tags: #color, #css, #functions, #web
- tuts/css/functions/color/light-dark shared tags: #color, #css, #functions, #tier, #web
- tuts/css/functions/color/linear-gradient shared tags: #color, #css, #functions, #tier, #web
- tuts/css/functions/math/calc shared tags: #css, #functions, #tier, #web
- tuts/css/functions/math/clamp shared tags: #css, #functions, #tier, #web
- tuts/css/functions/math/min shared tags: #css, #functions, #tier, #web
- tuts/css/functions/math/minmax shared tags: #css, #functions, #tier, #web