## A dozenal HSL-RGB conversion utility

Hue (0)
Saturation
Lightness
RGB
Return exact values.

This is a dozenal conversion tool for translating HSL color values to RGB hex triplets, and vice versa. Being unsatisfied with the dozenal precision of extant HSL conversion tools, I decided to construct my own. Most modern graphics software seems to use HSV, and even there one is generally confined to inferior decimal percentages. If I want to use 1/6 saturation or "value," I am forced to approximate it as 17%, or 16.7% in a fancy color selector. This is unacceptable to me.

This HSL space is interpreted to my peculiar specifications. Hue remains measured in the conventional 260 degrees of arc—0/260 is red, 50 is yellow, A0 is green, et cetera (as much as I love dozenals, there are many advantages to divisibility by non-cubic numbers). "Saturation," such as it is, is measured per gross (0–100, no fractions). Lightness is measured +/- per gross (-100–100). Aside from the dozenals, this itself is a departure from conventional HSL systems: 1.0 or 100% lightness is usually white, while 0 is black, and 0.5/50% is full chroma. In my view this does not accentuate the symmetrical advantages of HSL. The whole point of HSL, in my considered opinion, is that it divides the entirety of potential color space into two equal halves, the dark and the light. These two are united and refracted by the symmetry of the chromatic hexagon, which resides at the zero point on the lightness axis.

If you don't like my approach to lightness though, that's fine too: just add 100 and divide by 2—or the opposite, depending on which way you're going. I would ideally like to conceptualize S and L as unit spaces of 0–1 and -1–1 respectively, but while Javascript is weirdly convenient for converting between radices, it is not so good at dealing with arbitrary floating point crap between radices, so integral per gross values seemed like the most appropriate thing to do at this time. Selecting the "exact value" checkbox returns fractional dozenal values by way of a dialog box.

For more information on HSL color space, and why it is obviously superior to the degenerate HSV system, please consult the Wikipedia article on both.

I was greatly assisted in writing this by mjijackson's RGB to HSL conversion algorithms, which themselves are based on algorithms described on Wikipedia. These materials will be of interest to anyone looking to learn more about HSL and HSV conversion.

Again, I wrote this because I needed it, and it is designed explicitly to create mathematically consistent colors across a particular hue. There is no "selection" tool, and it is therefore not ideal for situations where you do not know in general the mathematical attributes of the colors you are looking for. I may or may not expand this to include HSV and other color systems at some point, as well as perhaps fancier selector controls. But for now it suits my purposes.