On this page
color-mix()
Prev: `oklch()` | Up: color | Next: `light-dark()`
Rel: color, Color & Value Functions Guide
Ref: MDN Web Docs — color-mix()
Tags: #public #web #css #functions #color #tier/standard
Syntax & Overview
color-mix(in oklch, var(--brand) 85%, black)
Blends two colors in a chosen color space to derive hover/border/surface variants dynamically.
Notes & Best Practices
- Specify
in oklch(orin srgb):in oklchavoids muddy gray midpoints when mixing complementary colors. - Great for generating hover/disabled tints directly from a single brand custom property.
Example
:root { --brand: oklch(58% 0.18 250); }
.btn { background: var(--brand); }
.btn:hover { background: color-mix(in oklch, var(--brand) 85%, white); }
Linked from
Related notes
- tuts/css/functions/color/light-dark Linked here; links to this page; shared tags: #color, #css, #functions, #tier, #web
- tuts/css/functions/color/oklch 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/linear-gradient shared tags: #color, #css, #functions, #tier, #web
- tuts/css/functions/color/var 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