Random RGB Color Generator

RGB triplets for CSS, canvas, and design tools

Ad placeholder (leaderboard)

Random colors are most useful when they are still on-brand or at least usable. This generator picks colors in the HSL space inside ranges you control, then converts them to the RGB triplets that CSS, canvas, and WebGL expect.

How it works

Choosing three independent random bytes for red, green, and blue tends to produce dull, unpredictable results. Instead, the tool samples a random hue, saturation, and lightness within your limits and converts that HSL color to RGB using the standard chroma formula:

C = (1 - |2L - 1|) * S
X = C * (1 - |((H / 60) mod 2) - 1|)
m = L - C / 2
(R, G, B) = (rgb' + m) * 255   // rgb' chosen by hue sextant

The three results are rounded to integers from 0 to 255 and shown as both an rgb() string and a hex code.

Tips and examples

Keep the hue range narrow (for example 200 to 230) to generate variations of a single color family, useful for data-visualization series or shader test inputs. Widen saturation and lightness for more variety. For canvas or WebGL, remember to divide each channel by 255 to get the 0-to-1 floats those APIs use. When you find a base you like, drop it into the Monochromatic Palette Generator to expand it into a full tint-and-shade scale.

Ad placeholder (rectangle)