Skip to content
UniKit

Color preview

Turn a list of colors (#rgb, #rrggbb, rgb(), hsl() or CSS named colors) into swatches: each one shows HEX / RGB / HSL, its WCAG relative luminance, the contrast against white and black (4.5:1 and 3:1 verdicts) and the recommended text color, while unparsable lines are listed and skipped.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Color list

One color per line: #rgb / #rrggbb, rgb() / rgba(), hsl() / hsla(), or a CSS named color such as tomato.

Colors (one per line)

Preview

Every swatch shows HEX / RGB / HSL plus its WCAG relative luminance and contrast verdicts.

Enter colors to see swatches, all three notations and the contrast verdicts.

What this tool does

  • Lay out a list of color values from a design file or stylesheet in one pass: HEX, RGB and HSL notation plus luminance and contrast verdicts on every card.
  • Check whether the colors in a palette can carry text or act as a background: 4.5:1 (AA body text) and 3:1 (large text, UI components) are judged separately.
  • Spot the values in a pasted list that this site cannot read — 8-digit HEX, misspelled named colors — because they are listed separately instead of silently dropped.

Example

Input

#FF0000
rgb(0, 128, 255)
tomato

Output

#FF0000 | rgb(255, 0, 0) | hsl(0, 100%, 50%) | L=0.2126 | on-white=4.00:1 | on-black=5.25:1 | text=#000000
#0080FF | rgb(0, 128, 255) | hsl(209.88, 100%, 50%) | L=0.2266 | on-white=3.80:1 | on-black=5.53:1 | text=#000000
#FF6347 | rgb(255, 99, 71) | hsl(9.13, 100%, 63.92%) | L=0.3064 | on-white=2.95:1 | on-black=7.13:1 | text=#000000

Each line is HEX, rgb(), hsl(), WCAG relative luminance, the contrast against white and black, and the text color recommended on that color.

Frequently asked questions

Which color notations are supported?

All of #rgb and #rrggbb, rgb() / rgba(), hsl() / hsla(), plus the 148 named colors defined by CSS Color 4 (tomato, rebeccapurple, …). Three-digit shorthands are expanded to six digits; 8-digit HEX with alpha (#rrggbbaa) is not parsed and lands in the unparsable list.

How is the contrast ratio calculated?

Per WCAG 2.2: linearize the sRGB channels (c / 12.92 when c ≤ 0.03928, otherwise ((c + 0.055) / 1.055) ^ 2.4), take the relative luminance L = 0.2126R + 0.7152G + 0.0722B, then ratio = (Llighter + 0.05) / (Ldarker + 0.05), which runs from 1:1 to 21:1. 4.5:1 is the AA body-text threshold, 3:1 the large-text and UI-component threshold.

How is the recommended text color picked?

Only pure white #FFFFFF and pure black #000000 are compared and the one with the higher ratio wins. No arbitrary text color is searched, and none of your input colors are modified.

Does this tool do color management?

No. Everything is computed in numeric sRGB space: no ICC profiles, no display color management, no gamut mapping, so the same numbers can look different across screens.

Do invalid colors break the preview?

No. Unparsable lines are listed separately and skipped, the remaining colors still render, and the summary shows valid colors, invalid lines and unique colors.

Keywords:relative luminancecolor previewnamed colorscontrast checker

Related tools