Color Mixer
Blend two colors across 11 steps and copy each result as HEX, RGB, HSL or a CSS color-mix() expression.
How to use the color mixer
- Set color A, the 0% end, by typing a value or using its swatch picker.
- Set color B, the 100% end, the same way.
- Read the 11 steps. The first is pure A, the last is pure B, and each step in between moves 10% further toward B.
- Check the HEX, RGB and HSL values under each step, plus its equivalent
color-mix(in srgb, …)expression. - Copy all 11 hex codes at once to paste into a design file or token list.
How the 11 steps are calculated
The mixer interpolates each RGB channel along a straight line. At the 30% step, every channel is 70% of color A plus 30% of color B, rounded to a whole number. Mixing #ff0000 and #0000ff at 50% gives rgb(128, 0, 128), which is #800080, the CSS named color purple.
Because the math runs on ordinary sRGB values, each step matches color-mix(in srgb, …) to within rounding, so the hex shown is the color the browser draws for that expression. It also inherits sRGB's weak spot: complementary pairs meet at gray. Red #ff0000 and cyan #00ffff mixed 50/50 land on #808080.
The color-mix() syntax
color-mix() comes from CSS Color Level 5 and has worked in all major browsers since 2023. It takes an interpolation space and two colors, each with an optional percentage:
color-mix(in srgb, #6366f1 70%, white)
That is 70% #6366f1 and 30% white, which renders as #9294f5. The percentage rules: give one percentage and the other color gets the remainder; give none and the mix is 50/50; give two that add up to less than 100% and the result turns partly transparent. Valid spaces include srgb, srgb-linear, hsl, lab, lch, oklab and oklch.
sRGB vs OKLab and OKLCH mixing
in srgb is predictable and matches this tool, but mixes of distant hues go dull in the middle. in oklab blends in a perceptual space, so lightness changes evenly and the midpoint looks less murky, though complementary pairs still lose saturation. in oklch interpolates the hue angle around the wheel and keeps chroma: the halfway point of red and blue becomes a bright magenta-purple instead of the darker #800080, and red and cyan pass through yellow-green rather than gray. The trade-off is that OKLCH can pass through a hue neither input contains. The OKLCH explainer covers why its lightness and hue stay stable.
Where color-mix() pays off
- Hover and active states:
--brand-hover: color-mix(in oklch, var(--brand) 85%, black);darkens any brand color by a consistent amount, so a retheme only changes--brand. - Tinted borders and overlays:
color-mix(in srgb, var(--brand) 20%, transparent)returns the brand color at 20% opacity, useful for focus rings, selected rows and dividers. - Design tokens: derive surface, border and subtle-background tokens from one or two base colors instead of hard-coding a dozen hexes.
When you need fixed hex values for a design tool or an older codebase, run the same pair through the mixer and copy the steps. Any mix used for text still needs a pass through the contrast checker.
Frequently asked questions
What does the percentage in color-mix() mean?
It is that color's share of the mix. color-mix(in srgb, red 30%, blue) is 30% red and 70% blue, and with no percentages each color gets 50%.
Which color space should I use in color-mix()?
Use srgb when results must match hex-based designs or this mixer. Use oklab for even lightness changes, and oklch when mixes between different hues should stay saturated.
Why is a 50/50 mix of two colors gray?
In sRGB, mixing complementary colors averages every channel toward the middle, so red #ff0000 and cyan #00ffff give #808080. Mix in oklch, or choose colors that sit closer together on the wheel.
Is color-mix() supported in all browsers?
Current Chrome, Edge, Firefox and Safari have supported it since 2023. For very old browsers, declare a plain hex value first and the color-mix() value on the next line.
Can I mix a color with transparent?
Yes. color-mix(in srgb, #6366f1 25%, transparent) returns #6366f1 at 25% opacity, because the browser mixes with premultiplied alpha. It is a clean way to build tinted borders and overlays from one brand variable.