Which color space does CSS's linear-gradient() function uses, RGB, HSL or HSV and why ?
Can I change the color space of my own choice ?
Which color space does CSS's linear-gradient() function uses, RGB, HSL or HSV and why ?
Can I change the color space of my own choice ?
keithjgrant
On
If you don't specify a color space in the gradient function, the default space is sRGB (though Chrome has a bug where this is not quite right in MacOS).
Browsers have begun to ship the newer syntax, which allows you to specify the color space: linear-gradient(in oklch 90deg, red, blue). Valid color spaces are hsl, hwb, lch, oklch (the polar spaces) and srgb, srgb-linear, lab, oklab, xyz, xyz-d50, and xyz-d65 (the rectangular spaces).
As of late 2023, this syntax is supported in Chrome, Safari, and Edge, but not Firefox.
Copyright © 2021 Jogjafile Inc.
In the future you can specify the color space
You can keep reading for more detail
Safari has some support for this if you want to test: https://twitter.com/argyleink/status/1490376117064065025