Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
111
111
113
16.2
111
16.2
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

CSS
/* Basic blending (sRGB) */
.mixed {
  color: color-mix(in srgb, #ff0000, #0000ff);
}

/* Specify percentage */
.light-brand {
  background: color-mix(in oklch, var(--brand) 80%, white);
}

/* Adjusting transparency */
.faded {
  color: color-mix(in srgb, var(--text-color) 60%, transparent);
}

/* Adjusting brightness on hover */
.button:hover {
  background: color-mix(in oklch, var(--btn-bg) 85%, black);
}

Live demo

2color. blend

color-mix() function 2color. blend demo.

PreviewFullscreen

white mixbright

color-mix() function white mixbright demo.

PreviewFullscreen

opacity. adjust

color-mix() function opacity. adjust demo.

PreviewFullscreen

Use cases

  • Using color-mix()

    The color-mix() functional notation takes one or more <color> values and returns the result of mixing them in a given colorspace by a given amount.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Make sure visual changes are conveyed appropriately to assistive technology.