将 HSB/HSV 颜色转换为 HSL [英] Convert HSB/HSV color to HSL
本文介绍了将 HSB/HSV 颜色转换为 HSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将 HSB 颜色转换为 HSL?
Ho do I convert HSB color to HSL?
Photoshop 在其颜色选择器中显示 HSB 颜色.可以在 CSS 中使用 HSL 颜色.
Photoshop shows HSB color in its color picker. HSL color can be used in CSS.
我试过这个JS:
function hsb2hsl(h, s, b) {
return {
h: h,
s: s,
l: b-s/2
}
}
但是 hsb2hsl(0, 100, 50).l == 0
而不是 25
更新:我可以在不转换 HSB → RGB → HSL 的情况下做到这一点吗?
Update: Can I do that without converting HSB → RGB → HSL?
推荐答案
恐怕我的 Javascript 知识缺乏,但您应该能够从 http://ariya.blogspot.com/2008/07/converting-between-hsl-and-hsv.html
I'm afraid my Javascript knowledge is lacking, but you should be able to infer the conversion from http://ariya.blogspot.com/2008/07/converting-between-hsl-and-hsv.html
这篇关于将 HSB/HSV 颜色转换为 HSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文