I am looking for a tool or the algorithm to convert between HSL color to RGB. It seems to me that HSL is not very widely used so I am not having much luck searching for a converter.
相关问题
- DBGrid - How to set an individual background color
- How to display an image represented by three matri
- How to delete a certain part of an Image?
- draw polylines with different colors on v2 maps
- How do I change the color of the navigation bar ic
相关文章
- Emacs/xterm color annoyance on Linux
- matplotlib bwr-colormap, always centered on zero
- MeshLab: How to import XYZRGB file
- How to add RGB values into setColor() in Java?
- ChartJS. Change axis line color
- set foreground color in FrameLayout in android pro
- Changing background color for a text annotation to
- Keras: Visualize ImageDataGenerator Output
Here is the modified javascript function, it outputs Hue in set 0-360 degrees.
An hsl|a color value, set in javascript, will be instantly converted to rgb|a All you need to do then is access the computed style value
Technically, I guess, this isn't even any lines of code - it's just done automatically. So, depending on your environment, you might be able to get away with just this. Not that there aren't a lot of very thoughtful responses here. I don't know what your goal is.
Now, what if you want to convert from rbg|a to hsl|a?
Unity3D C# Code from Mohsen's answer.
Here is the code from Mohsen's answer in C# targeted specifically for Unity3D. It was adapted from the C# answer given by Alec Thilenius above.
I needed a really light weight one, Its not 100%, but it gets close enough for some usecases.
For when you need RGB to HSV and vice versa instead:
If you're looking for something that definitely conforms with the CSS semantics for HSL and RGB, you could use the algorithm specified in the CSS 3 specification, which reads:
I believe this is the source for some of the other answers here.