RGB to HSL conversion

I’ve been reading several wiki pages and checking different calculations, and creating visualizations of RGB cube projection onto a hexagon. And I’d like to post my understanding of this conversion. Since I find this conversion (representations of color models using geometric shapes) interesting, I’ll try to be as thorough as I can be. First, let’s … Read more

Why doesn’t hue rotation by +180deg and -180deg yield the original color?

In both CSS and SVG filters, there is no conversion into HSV or HSL – the hueRotation shorthands are using a linear matrix approximation in RGB space to perform the hue rotation. This doesn’t conserve saturation or brightness very well for small rotations and highly saturated colors – as you’re seeing. A true hue rotation, … Read more

HSL to RGB color conversion

Garry Tan posted a Javascript solution on his blog (which he attributes to a now defunct mjijackson.com, but is archived here and the original author has a gist – thanks to user2441511). The code is re-posted below: HSL to RGB: /** * Converts an HSL color value to RGB. Conversion formula * adapted from http://en.wikipedia.org/wiki/HSL_color_space. … Read more