R – Why are max values for saturation and hue are 240 and 239 respectively

colorsvb.netwinforms

In ColorDialog why are the max values for saturation and hue are 240 and 239 respectively? To what do they correspond?

Best Answer

"In Windows, the HSL and HSV spaces are usually remapped to a scale between 0 to 240 so that colors can be represented with a 32-bit value."

See http://msdn.microsoft.com/en-us/library/aa511283.aspx

Hue is expressed as an angle around the color wheel, in this case multiplied by 2/3 to stay under 240 degrees. The highest value is 239 because 240 = 0 just as 360 degrees = 0 degrees on a compass.