CSS <color-interpolation-method> Data Type
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.
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
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
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.
Desktop





Tablets & Mobile





