2.151 .hls[enum]
This attribute defines the hue, lightness and saturation of an HLS color at a color resource.
Definition
-
Data type
integer
-
Access
get, set
-
changed event
no
Index Range
- color_hue
-
Determines the hue.
- color_light
-
Determines the lightness (luminance).
- color_sat
-
Determines the saturation.
In the HLS color model, colors are defined by hue H, lightness or luminance L, and saturation S. The range for all three values is 0 to 255.
The colors are arranged within a cylinder whose top plane is white and whose bottom plane is black. Lightness L increases from 0 (dark) at the bottom to 255 (bright) at the top. For colors within the circle intersecting the center point of the cylinder, L is 127. These colors are neither brightened (by mixture with white) nor darkened (by mixture with black).
Hue H is determined by the angle on the circular area. The range for H from 0 to 255 and the angle A in the color circle (actually ranging from 0 to 359 degrees) relate as given below:
- H = A / 2.
- A = (H modulo 180) * 2; that is the values from 180 to 255 match the color shades from 0 to 75.
Red has a value of H = 0 (or 180), H = 60 (or 240) yields green and H = 120 yields blue.
The shades of gray lie on the vertical line through the center of the cylinder, all having a saturation of S = 0. The colors on the lateral area of the cylinder have the highest saturation S = 255. The colors on the perimeter of the middle circle with L = 127 and S = 255 sometimes are referred as pure colors.
Note
The attributes .rgb[enum], .hls[enum] and .name are mutually exclusive, so that get
may lead to a can't get value error message.