Online HSL to RGB color conversion
Online Web Code Test |
Online Image Picker |
Online Color Picker
HSL to RGB color conversion
Enter hue in degrees (°), saturation and lightness (0..100%) and press the Convert button:
HSL to RGB transformation formula
When 0 ≤ H < 360, zero ≤ S ≤ 1 and zero) &instances; S
X = C &instances; (1 - instances;255, (G'+m)&instances;255,(B'+m)×255)
HSL (Hue, Saturation, and Lightness) and RGB (Red, Green, and Blue) are particular colour fashions generally carried out in pc pix and image processing. Converting a colour from HSL to RGB allows you to symbolize the shade in phrases of its purple, green, and blue components, which can be normally used to show shades on video display devices.
Here's how you could carry out the conversion from HSL to RGB:
- Normalize the hue price (H) to some of 0 to at least one thru dividing it with the useful useful aid of 360 (the maximum charge for hue).
- Normalize the saturation rate (S) and lightness charge (L) to an expansion of zero to as a minimum one via dividing them with the beneficial useful resource of one hundred (the most values for saturation and lightness).
- If the saturation rate (S) is 0 (achromatic color), set all three RGB additives to the lightness charge (L) increased with the resource of 255 (the most fee for an eight-bit colour channel), rounded to the nearest entire amount.
- If the saturation price (S) is greater than zero, calculate the temporary variables primarily based totally on the hue charge (H):
- Determine which sextant the hue fee falls into (0 to five) to set the initial RGB values:
- Add the quick variable m to every RGB detail and multiply thru 255, rounding to the nearest entire amount.
Calculate the transient variable C = (1 - abs(2 * L - 1)) * S.
Calculate the brief variables X = C * (1 - abs((H * 6) mod 2 - 1)).
Calculate the fast variable m = L - C/2.
If 0 ≤ H < 1 or five ≤ H < 6, set the initial RGB values to (C, X, zero).
If 1 ≤ H < 2, set the initial RGB values to (X, C, zero).
If 2 ≤ H < three, set the preliminary RGB values to (zero, C, X).
If three ≤ H < four, set the preliminary RGB values to (zero, X, C).
If four ≤ H < five, set the preliminary RGB values to (X, 0, C).
After following the ones steps, you may have the RGB values representing the shade within the form of 0 to 255. These values can then be used to expose or control the color in numerous programs.
It's properly properly really worth noting that there may be slight variations in the implementation of the conversion set of policies, specifically in how the fast values are calculated or rounded. Different programming languages or libraries may additionally furthermore offer their very personal talents or strategies for HSL to RGB conversion, so it's far useful to are seeking out recommendation from the documentation specific to the language or library you are the use of for correct effects.
HSL to RGB tone table
Color | Color name |
(H,S,L) | Hex | (R,G,B) |
---|---|---|---|---|
Black | (0°,0%,0%) | #000000 | (0,0,0) | |
White | (0°,0%,100%) | #FFFFFF | (255,255,255) | |
Red | (0°,100%,50%) | #FF0000 | (255,0,0) | |
Lime | (120°,100%,50%) | #00FF00 | (0,255,0) | |
Blue | (240°,100%,50%) | #0000FF | (0,0,255) | |
Yellow | (60°,100%,50%) | #FFFF00 | (255,255,0) | |
Cyan | (180°,100%,50%) | #00FFFF | (0,255,255) | |
Magenta | (300°,100%,50%) | #FF00FF | (255,0,255) | |
Silver | (0°,0%,75%) | #BFBFBF | (191,191,191) | |
Gray | (0°,0%,50%) | #808080 | (128,128,128) | |
Maroon | (0°,100%,25%) | #800000 | (128,0,0) | |
Olive | (60°,100%,25%) | #808000 | (128,128,0) | |
Green | (120°,100%,25%) | #008000 | (0,128,0) | |
Purple | (300°,100%,25%) | #800080 | (128,0,128) | |
Teal | (180°,100%,25%) | #008080 | (0,128,128) | |
Navy | (240°,100%,25%) | #000080 | (0,0,128) |
Online Color Calculators
Online Web Code Test |
Online Image Picker |
Online Color Picker