Convert RGB/RGBA decimal color values to HSL (Hue, Saturation, Lightness) and HSV color spaces with interactive angle sliders and CSS output.
First normalize R, G, B to 0-1. Find max and min values. Lightness is (max + min)/2. If max == min, Hue and Saturation are 0 (gray). Otherwise Saturation is (max - min) / (1 - |2L - 1|), and Hue is calculated from which channel is maximum.