Color Mixer

Blend two colors at any ratio and get the exact result, plus a row of evenly spaced steps between them. Mixing here works like light, not paint, so blue and yellow give grey, not green.

Steps from A to B

Digital Color Mixing: Why Blue + Yellow Doesn’t Make Green on Screen

In school we learn that blue and yellow make green. Try mixing #0000FF and #FFFF00 in a digital color mixer, though, and you get a flat grey, #808080. Nothing is broken. Screens and paint mix color in completely different ways, and once you understand the difference, digital mixing becomes a precise and useful design tool.

Blue and yellow mixed digitally to grey compared with paint mixing to green

Additive versus subtractive mixing

Paint and ink mix subtractively. Pigments absorb (subtract) certain wavelengths of light and reflect the rest. Yellow paint absorbs blue light; blue paint absorbs red and some green. Mix them, and the only wavelengths both reflect are in the green range, so you see green. The more pigments you add, the darker the mix gets.

Screens mix additively. Pixels emit light. Red, green and blue light add together; all three at full strength make white. Yellow on screen is red light plus green light. Blue is blue light.

A digital color mixer averages. When software “mixes” two colors, it usually doesn’t simulate paint at all. It interpolates each RGB channel: halfway between blue (0, 0, 255) and yellow (255, 255, 0) is (128, 128, 128), which is grey. The two colors are complementary on the RGB wheel, so averaging them cancels out the hue.

Mixing typeExampleBlue + Yellow givesUsed in
Subtractive (pigment)Paint, inkGreenArt, printing
Additive (light)Stage lights, displaysWhite (if both lights shine together)Hardware, lighting
Interpolation (averaging)Design software, CSSGreyGradients, tints, UI states

Some painting apps simulate pigment behaviour with specialised models, but standard design tools, CSS and image editors interpolate.

Why interpolation is useful

Averaging sounds less magical than paint, but it is exactly what interface design needs:

  • Hover states. Mix a button color 12% toward black for a predictable, slightly darker hover.
  • Tinted backgrounds. Mix 10% of a brand color into white for a subtle branded surface.
  • Fake transparency. Mixing a color with the background color gives the same visual result as transparency, without layering problems.
  • Gradient steps. Five evenly spaced mixes between two colors give a smooth sequential scale for charts and maps.
  • Finding a midpoint. The halfway color between two brand colors often makes a harmonious third color.

The color mixer above does this with a slider for the ratio and shows a row of steps between the two colors.

The muddy middle problem

Mixing two saturated colors that are far apart on the color wheel produces desaturated, greyish midpoints. This is why some CSS gradients look dull in the middle, for example a gradient from blue to orange.

The cause is that interpolation in sRGB takes a straight line through the color cube, and that line passes close to the grey axis. There are two common fixes:

  1. Add a middle color stop that keeps saturation high, for example blue → purple → orange.
  2. Interpolate in a different color space. Modern CSS lets you choose: linear-gradient(in oklch, blue, orange) or color-mix(in oklch, blue, orange). OKLCH interpolates hue around the wheel, keeping saturation, so the midpoint becomes a vivid color rather than grey.
Color spaceBlue → orange midpointNotes
sRGBGreyishDefault for older CSS, Sass mix()
Linear sRGBLighter grey-pinkPhysically accurate light mixing
OKLabSmooth, slightly mutedPerceptually even
OKLCHVivid magenta or green, depending on hue directionKeeps chroma, can produce unexpected hues

There is no single “correct” space. sRGB is predictable and matches most design tools. OKLab gives the smoothest perceptual steps. OKLCH keeps colors vivid. Try a few and pick the result you like.

Mixing in CSS today

The color-mix() function is supported in all current major browsers:

.button:hover { background: color-mix(in srgb, var(--brand) 88%, black); }
.card { background: color-mix(in srgb, var(--brand) 8%, white); }

The percentage is the amount of the first color. This makes it easy to build complete themes from one or two variables, and to let users pick a custom accent color without recalculating dozens of tokens.

For design systems you hand to other teams, fixed tokens (exact HEX values) are still easier to document and audit for contrast. A good compromise is to use color-mix() while exploring, then bake the results into tokens with a tints and shades generator or color scale generator.

Practical mixing recipes

  • Hover on dark buttons: mix 10–15% toward white.
  • Hover on light buttons: mix 5–10% toward black.
  • Disabled state: mix 50–60% toward the background color.
  • Subtle branded surface: 5–10% brand color into white (light mode) or into near-black (dark mode).
  • Chart scale: five to seven steps from a light neutral to your brand color.
  • Tinted neutrals: mix 3–8% of your brand hue into each grey.

Checking contrast after mixing

Mixed colors change lightness, so recheck text contrast. A hover state that darkens a button increases contrast with white text, which is fine. A disabled state that fades toward the background will lower contrast; that is allowed for disabled controls under WCAG, but don’t use the same faded color for active text. Our contrast checker makes this a ten-second job.