Linear-gradient() 使用哪个颜色空间?
CSS的线性级函数()函数使用RGB,HSL或HSV哪个颜色空间?为什么?
我可以更改自己选择的颜色空间吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
CSS的线性级函数()函数使用RGB,HSL或HSV哪个颜色空间?为什么?
我可以更改自己选择的颜色空间吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
将来您可以指定颜色空间
如果您想测试,您可以继续阅读以获取更多详细信息
Safari对此有一些支持: https://twitter .com/argyleink/status/1490376117064065025
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
如果您未在渐变函数中指定颜色空间,则默认空间为 sRGB(尽管 Chrome 有一个错误,这在 MacOS 中不太正确)。
浏览器已开始发布 较新的语法,允许您指定颜色空间:
线性渐变(在 oklch 90deg、红色、蓝色中)
。有效的颜色空间为hsl
、hwb
、lch
、oklch
(极坐标空间)和srgb< /code>、
srgb-线性
、lab
、oklab
、xyz
、xyz-d50
代码>,和xyz-d65
(矩形空间)。截至 2023 年末,Chrome、Safari 和 Edge 支持此语法,但 Firefox 不支持。
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 arehsl
,hwb
,lch
,oklch
(the polar spaces) andsrgb
,srgb-linear
,lab
,oklab
,xyz
,xyz-d50
, andxyz-d65
(the rectangular spaces).As of late 2023, this syntax is supported in Chrome, Safari, and Edge, but not Firefox.