Getting a chosen colour into a canvas
Pick the colour in HSL where it is easy, convert to RGB, and pass the channels to a drawing API.
Converts hsl colour to rgb in this tab, with nothing sent anywhere.
Find related browser-local tools for nearby tasks without starting another search.
Browse all general convertersHSL is the comfortable model for choosing and adjusting a colour, but the machinery underneath - canvases, graphics libraries, image buffers - almost always works in RGB. So once you have dialled in a colour as a hue, saturation and lightness, converting it to red, green and blue is how you get it into code that draws. The conversion is the inverse of the RGB-to-HSL formula and is exact up to rounding: a colour chosen in HSL produces a definite set of three channel values. This reads the three HSL components from whatever form they arrive in, applies the standard conversion, and returns the rgb() value ready to drop into a graphics call or a stylesheet.
Pick the colour in HSL where it is easy, convert to RGB, and pass the channels to a drawing API.
Some tooling prefers explicit RGB. Convert your HSL and paste the result.
HSL saturation and lightness are percentages, while the RGB result uses channel values from 0 to 255. Do not treat 0.5 as 50% unless the input explicitly accepts a fractional convention. Compare the resulting swatch on the intended background; a numeric conversion alone does not check text contrast.
Up to rounding to whole channels, yes. The formula is the exact inverse of RGB to HSL.
hsl() notation or three bare numbers. Percent signs on saturation and lightness are fine.
No. It produces opaque RGB. Add the alpha separately if you need rgba.
They are clamped to the nearest valid value rather than rejected.
No. The conversion runs in this tab.
Convert an RGB colour to HSL in your browser, the model that makes colours easy to adjust.
Convert an HSL colour to a hex code in your browser.
Convert an RGB colour to a hex code in your browser, from any common RGB format.