News for hackers. Stuff that matters.
Re:The Code Side Of Color by NelsonMinar on Thursday October 04, 2012 @12:53PM (#4613185)
Trying to work with color in RGB triplets is like trying to assemble furniture with a plastic fork. Any discussion of color for programmers needs to be in terms of HSL, with a discussion of Lab for completeness and RGB for dealing with legacy systems.
Re:The Code Side Of Color by Chris_Newton on Thursday October 04, 2012 @04:40PM (#4614277)
Trying to work with color in RGB triplets is like trying to assemble furniture with a plastic fork.

Agreed, but while HSL is surely more intuitive than RGB, it is still a relatively crude tool because the numbers typically aren’t calibrated in any useful way.

After studying colour theory for a long time, I became convinced that the most interesting colour systems are often those based on actual human perception rather than “arbitrary” physics or mathematics. See for example Munsell’s work[1], which is built around perceptually uniform changes as the values representing colours vary, or the Opponent Process theory[2], where hues are represented in terms of red-green and blue-yellow axes rather than placing three primary colours at the vertices of an equilateral triangle and then interpolating into a circle.

Personally, I have found the perceptual systems more useful than RGB or a traditional colour wheel and something like HSL built on it, particularly for technical/mechanical tasks that require generating variations of colours starting from one or more known anchor points like colours lifted from a photograph or a client’s branding guidelines. I think you always need a human touch, though: all useful colour models have multiple dimensions, and there is definitely both skill and art in making choices like whether to vary each dimension by large amounts, subtle but visible differences, or not at all.

Sadly, I fear we’re still many years from calibrated/environmentally-aware display devices being the norm. That means for something like web design, the majority of visitors to most sites are going to see all those lovingly chosen colours on a poorly calibrated screen that may scarcely resemble the original designer’s choices anyway, so to some extent trying hard to refine a colour scheme at the above level is mostly wasted effort, at least for now. Such is life. :-)

[1] http://en.wikipedia.org/wiki/Munsell_color_system

[2] http://en.wikipedia.org/wiki/Opponent_process

Re:The Code Side Of Color by trebor on Thursday October 04, 2012 @12:57PM (#4613205)
Maybe I'm getting old, though I'm not even 30 yet, but I've never grasped HSL like I have RGB and RGBA. I come from a background of toying with OpenGL and game programming, so it became habitual as that was the required structure ~10 years ago.
Re:The Code Side Of Color by andyzweb on Thursday October 04, 2012 @03:26PM (#4613915)
With openGL, DirectX, and other real-time rendering I believe sRGB or linear gamma are preferred because there are library and possibly hardware primitives that can be taken advantage of. Outside of that I feel we should be notating color in terms of the L* a* b* colors
Re:The Code Side Of Color by jarek-foksa on Friday October 05, 2012 @01:47AM (#4615811)
Web browsers also seem to be using RGB for storing colors internally. You can specify colors in HSL, but retrieved values are only in RGB. E.g. if you write "hsl(100,0%,0%)" in your CSS file then the color will be represented as #000000 in DOM/CSSOM. This is especially annoying when you are trying to implement color picker because information about hue is lost if saturation or lightness are low.
Re:The Code Side Of Color by trebor on Thursday October 04, 2012 @04:49PM (#4614326)
Using LAB wouldn't be so bad. It'd take quite some adjustment though.