What tools are used for working with HSL colors in .net?
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
- Should I use static function in c# where many call
This ColorRGB class provides ways to get and set HSL, along with implicit conversions to and from System.Drawing.Color. It's based on an excellent example from GeekMonkey.com.
The color struct provides three methods: GetHue, GetSaturation and GetBrightness.
Bob Powell wrote an interesting piece on this several years ago.
Bizarre historical note -- "HSL" (and the related "HSV") are one of the many things originating from Xerox's Palo Alto Research Center (PARC) in the 70's, courtesy of Alvy Ray Smith.
In addition to secretGeek's answer, to get a color from HSL values (or vice-versa), you can also use these native function calls (sample code in Visual Basic):
(using
ColorTranslator.ToWin32
andColorTranslator.FromWin32
when passing/receiving the color argument/result)