简体   繁体   English

如何在 JavaScript 中将十六进制颜色转换为 CSS3 过滤器选项?

[英]How can I convert the hex color to CSS3 filter options in JavaScript?

I have the hex color (ie #ff0000 ).我有十六进制颜色(即#ff0000 )。 I want it to use on CSS3 filter options as hue saturation and brightness.我希望它在 CSS3 过滤器选项上用作色调饱和度和亮度。 I can use JavaScript, but don't know how can I convert it to this.我可以使用 JavaScript,但不知道如何将其转换为这个。

I mean I'll convert it to RGB, than HSL and than CSS3 filter options(hue-rotate, saturation and brightness)我的意思是我会将它转换为 RGB,而不是 HSL 和 CSS3 过滤器选项(色相旋转、饱和度和亮度)

I found this one: https://gist.github.com/barretts/e90d7e5251f36b183c67e02ba54c9ae1我找到了这个: https : //gist.github.com/barretts/e90d7e5251f36b183c67e02ba54c9ae1

You can try serveral times to get the best results.您可以尝试多次以获得最佳效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM