Design Tokens

Algorithmic color palette derivation directly in CSS using native color-mix()

Hardcoding dozens of transparent RGBA color variants by hand is tedious and error-prone. In this lab, I'll show you how modern color-mix() lets you generate dynamic hover tints, translucent surfaces, and accessible borders from a single base color token.

📖 Read the Complete Tutorial: CSS color-mix() & Gamut Guide →
CSS color-mix() & Gamut Visualizer

How to Use the color-mix() Generator (3 Simple Steps)

1

Select Color Space

Choose between OKLCH (perceptually uniform), Display P3 (vibrant OLED gamut), sRGB (classic), or OKLab for your blend engine.

2

Set Base & Blend Colors

Pick two colors and adjust the percentage slider. In cylindrical spaces, select shorter vs longer hue paths around the color wheel.

3

Export Design Tokens

Copy structured CSS Custom Properties or Tailwind config variables containing a full 50–950 tint and shade scale.

Features & CSS Best Practices

✓

Eliminates Gray Dead Zones with OKLCH

In standard sRGB, blending blue and yellow yields a muddy gray midpoint. OKLCH maintains uniform lightness and vibrant chroma throughout.

✓

Dynamic Pure CSS Theme Derivation

Derive hover states, dark mode surfaces, and subdued border tints dynamically in CSS variables without compiling Sass or running JavaScript.

✓

Cylindrical Hue Interpolation Paths

Control whether transitions take the shorter hue shortcut or the longer hue scenic rainbow route across polar color coordinates.

✓

Full Evergreen Browser Support

Natively supported in Chrome 111+, Apple Safari 16.2+, Mozilla Firefox 113+, and Microsoft Edge 111+ without build polyfills.

WordPress & Elementor Integration

How to Use CSS color-mix() in Elementor

Derive dynamic tints, accessible hover states, and smooth color palettes in real time without Sass or hardcoded static color codes.

1

Configure Blend & Copy Code

Select your base colors, color space (OKLCH, Display P3, sRGB), and mix ratio. Switch to the Elementor / WP tab and click Copy Code.

2

Add to Site Settings Custom CSS

In Elementor editor, open the hamburger menu → Site Settings > Custom CSS (or WP Admin → Appearance > Customize > Additional CSS), and paste the snippet.

3

Apply Dynamic Hover Tints

Use color-mix() in widget Custom CSS to create seamless hover states: selector:hover { background: color-mix(in oklch, var(--brand) 85%, white); }.

Frequently Asked Questions

Why should I use color-mix() instead of Sass darken() or lighten()?

Sass darken() and lighten() operate at build time and cannot react to runtime variables like user-selected brand colors or system dark mode. color-mix() executes dynamically in the browser, allowing you to derive responsive color palettes directly from CSS custom properties in real-time.

Why does OKLCH produce superior gradients and mixes compared to sRGB?

sRGB is not perceptually uniform — human eyes perceive green as much brighter than blue at equal numerical values. OKLCH was engineered specifically around human vision, maintaining uniform perceived lightness and chroma so intermediate colors stay vibrant and natural.

How do I use color-mix() to create transparent opacity variations?

You can mix any color with transparent! For example, background: color-mix(in srgb, var(--primary) 20%, transparent); creates an exact 20% opacity tint of your primary brand variable while preserving the exact hue.

What is the syntax for shorter hue vs longer hue?

In cylindrical spaces (like OKLCH, LCH, and HSL), you append the hue interpolation method after the space name: color-mix(in oklch shorter hue, blue 50%, yellow) takes the shortest angle on the color wheel, while longer hue traverses the rest of the wheel.

What is the CSS color-mix() function and how does it work?

color-mix(in oklch, color1 percentage, color2) blends two colors together in a specified color space directly in the stylesheet, eliminating pre-calculated hex palettes for hover tints and shadows.

Why should I use OKLCH as the interpolation color space in color-mix()?

Interpolating colors in sRGB produces muddy gray midpoints between opposing hues. OKLCH is perceptually uniform, maintaining constant human-perceived lightness and vibrancy throughout the transition.

How do I create dynamic dark-mode surface tints using color-mix()?

Define a surface token: background: color-mix(in oklch, var(--primary) 12%, var(--bg-dark));. This automatically tints dark-mode cards with a hint of brand hue without declaring separate variables.

How do I use CSS color-mix() in Elementor?

Add the generated color-mix CSS variables from the Elementor / WP tab into Elementor > Site Settings > Custom CSS. You can then use color-mix() directly inside widget Custom CSS to generate dynamic hover tints (e.g. selector:hover { background: color-mix(in oklch, var(--primary) 85%, white); }) or subtle background overlays without hardcoding static color values.