How do I convert RGB to HSV?
Divide each channel by 255, take the highest channel as value, and divide the difference between the highest and lowest channel by the highest to get saturation. Hue comes from which channel is highest. rgb(37, 99, 235) is hsv(221, 84%, 92%).