Favorites

CSS <color-interpolation-method> Data Type

<color-interpolation-method>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <color-interpolation-method> data type sets the color space used to mix colors, written as in followed by a space such as oklch or srgb.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <color-interpolation-method> CSS data type specifies the color space used when the browser calculates the colors between two other colors. It is written as the keyword in followed by a color space name, for example in oklab or in hsl longer hue. It is used in color-mix(), where it is required, and optionally in gradient functions such as linear-gradient(), radial-gradient() and conic-gradient().

The choice of color space changes how a blend looks. Mixing in srgb, the traditional default for gradients, can produce dull, grayish midpoints between saturated colors. Perceptual spaces such as oklab and oklch give smoother, more even transitions that keep their brightness, which is why oklab is the default for many modern features. Rectangular spaces (srgb, srgb-linear, display-p3, a98-rgb, prophoto-rgb, rec2020, lab, oklab, xyz, xyz-d50, xyz-d65) blend each channel in a straight line. Polar spaces (hsl, hwb, lch, oklch) travel around the hue wheel, and can be followed by a <hue-interpolation-method> to choose which way round.

Examples:

/* Required in color-mix() */
.tint {
  background: color-mix(in oklab, #2563eb 70%, white);
}

/* Optional in gradients */
.smooth {
  background: linear-gradient(in oklch to right, #f43f5e, #3b82f6);
}

/* A full rainbow by taking the long way around the hue wheel */
.rainbow {
  background: linear-gradient(in hsl longer hue to right, red, red);
}

Interactive Demo

Demo Code
HTML Code
<div class="demo-element"></div>
CSS Code
.demo-element {
	width: 280px;
	height: 70px;
	border-radius: 8px;
	background: linear-gradient(to right in srgb, #4361ee, #ffd166);
}

Syntax

<color-interpolation-method> = in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? ]

<rectangular-color-space> = srgb | srgb-linear | display-p3 | a98-rgb | prophoto-rgb | rec2020 | lab | oklab | xyz | xyz-d50 | xyz-d65
<polar-color-space> = hsl | hwb | lch | oklch

Values

  • inRequired keyword that starts the interpolation method.
  • <rectangular-color-space>srgb, srgb-linear, display-p3, a98-rgb, prophoto-rgb, rec2020, lab, oklab, xyz, xyz-d50 or xyz-d65. Each channel is interpolated in a straight line.
  • <polar-color-space>hsl, hwb, lch or oklch. The hue is interpolated around the color wheel.
  • <hue-interpolation-method>Optional, polar spaces only: shorter hue (default), longer hue, increasing hue or decreasing hue.

Example

<div class="wrap">
<h1>CSS &lt;color-interpolation-method&gt; examples</h1>
<div class="grid">
<div class="card">
<div class="sw srgb"></div>
<div class="label">linear-gradient(in srgb, ...)</div>
</div>
<div class="card">
<div class="sw oklab"></div>
<div class="label">linear-gradient(in oklab, ...)</div>
</div>
<div class="card">
<div class="sw oklch"></div>
<div class="label">linear-gradient(in oklch, ...)</div>
</div>
<div class="card">
<div class="sw hsl-longer"></div>
<div class="label">linear-gradient(in hsl longer hue, ...)</div>
</div>
<div class="card">
<div class="sw mix-srgb"></div>
<div class="label">color-mix(in srgb, yellow, blue)</div>
</div>
<div class="card">
<div class="sw mix-oklch"></div>
<div class="label">color-mix(in oklch, yellow, blue)</div>
</div>
</div>
<p class="note">The same two colors look very different depending on the interpolation color space.</p>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fb;
  color: #102a43;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  color: #486581;
  margin-top: 10px;
  word-break: break-word;
}

.note {
  font-size: 13px;
  color: #486581;
  margin-top: 14px;
}

/*  examples */
.sw {
  height: 70px;
  border-radius: 8px;
}

.srgb { background: linear-gradient(in srgb to right, #f43f5e, #3b82f6); }
.oklab { background: linear-gradient(in oklab to right, #f43f5e, #3b82f6); }
.oklch { background: linear-gradient(in oklch to right, #f43f5e, #3b82f6); }
.hsl-longer { background: linear-gradient(in hsl longer hue to right, #f43f5e, #3b82f6); }
.mix-srgb { background: color-mix(in srgb, #facc15, #2563eb); }
.mix-oklch { background: color-mix(in oklch, #facc15, #2563eb); }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS color-interpolation-method data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.