Dev TooloraLocal dev tools

> CSS & Design

Color Mixer

Mix two CSS colors by weight in sRGB or the perceptual OKLab spaces and get the color-mix() rule with a resolved fallback.

Runs locallyWorks offline
Auto-run
Back to results
Input

Source data

%
Share of color A in the mix.
Color space
Output

Result

Your result will appear here.

Tool guide

About this tool.

  • The CSS color-mix() function blends two colors in a chosen color space. This tool does the same blend and prints both the resolved hex color and the color-mix() call.
  • Mixing follows CSS Color 5: alpha is premultiplied, so a transparent color does not tint the result, and in OKLCH the hue travels the shorter arc around the wheel. A hue is powerless when chroma is below 0.0002, and then the other color hue is used.
  • The resolved color is mapped into sRGB by reducing chroma, so the fallback is always displayable.

  • Building hover and active states from a brand color.
  • Generating a fallback for browsers without color-mix().
  • Comparing how sRGB, OKLab and OKLCH blend the same pair.
  • Finding a midpoint between two theme colors.

Pick two colors or type any CSS color: hex, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch() or a name.

Set the weight of color A from 0 to 100 percent. Color B takes the rest.

Choose the color space used for mixing. OKLCH is the default.

The output is a CSS rule with the resolved hex first and color-mix() second. The preview shows A, the mix and B, and the JSON report lists every format of the result.

  • #ff0000 and #0000ff at 50% in sRGB gives #800080
  • #000000 and #ffffff at 50% in sRGB gives #808080
  • #000000 and #ffffff at 50% in OKLab gives #636363
  • #ff0000 and #0000ff at 50% in OKLCH gives a hue near 326.6
  • Weight 100 returns color A and weight 0 returns color B
  • rgb(255 0 0 / 0) and #0000ff at 50% in sRGB gives #0000ff at half alpha

  • Colors print in the rule exactly as typed, trimmed, so a hex color needs its #.
  • The weight must be a whole number from 0 to 100.
  • Alpha is premultiplied before mixing.
  • OKLCH takes the shorter hue arc.
  • A hue is powerless when chroma is below 0.0002.
  • Other spaces such as hsl, lab and srgb-linear are not offered.

FAQ

Questions about Color Mixer

Why do the spaces give different results?

sRGB mixes gamma-encoded channels, which darkens midpoints. OKLab and OKLCH mix perceptual lightness, so the result looks more even.

Which way does the hue go?

In OKLCH the hue moves along the shorter arc of the wheel. Red to blue passes through magenta, not green.

Can I use colors with alpha?

Yes. Alpha is premultiplied as in CSS, so a fully transparent color contributes no color.

Why are there two color lines?

The first declaration is the resolved fallback and the second is color-mix(). Browsers that understand it use the second.

Continue with

Color Scale GeneratorGenerate a Tailwind-style 50 to 950 shade scale from one color, as CSS variables, Tailwind v3 or v4 config or JSON.Color ConverterConvert any CSS color, including hex, rgb(), hsl(), hwb(), oklch(), oklab(), lab(), lch() and named colors, with alpha, a live swatch and contrast on white and black.