Hex color format

A hex color is #RRGGBB, where each pair is a byte from 00 to FF. Shorthand #RGB expands each digit, so #f0a is #ff00aa. The alpha variant is #RRGGBBAA, with 00 fully transparent and FF fully opaque.

css
#3fa7d6  → rgb(63, 167, 214)
#3fa7d680 → 50% alpha

Random colors are rarely good palettes

Uniform random sampling produces a lot of muddy mid-tones. For a usable palette, constrain hue spacing, saturation and lightness rather than sampling all 16.7 million colors. Use random colors for placeholders and test fixtures, not for production branding.

  • Vary lightness within a fixed hue for a monochromatic palette.
  • Space hues evenly around the wheel for categorical charts.
  • Check contrast against the background before shipping text.

Contrast and accessibility

The preview shows contrast ratios against white and black. WCAG AA requires 4.5:1 for normal text and 3:1 for large text. A color that looks pleasant may fail badly for labels, so check the ratio before using it as a background.

Perceived brightness is not the same as luminance contrast. Use the computed ratio, not your eyes, for accessibility decisions.