Color picker & contrast
Foreground
Background
How to choose colors well
This page converts between HEX, RGB, and HSL representations of a color and reports the WCAG contrast ratio between a foreground and a background. The notes below explain the theory of color choice β what works for which situation, and what to avoid.
Color is rarely βgoodβ or βbadβ on its own. It is good or bad relative to a job: long-form reading, an alert, a brand wordmark, a chart legend. Picking color well means matching hue, saturation, and lightness to that job, then verifying the result with a contrast check.
The three dimensions of color
HSL describes a color along three axes that map to how humans actually perceive color. Knowing what each axis controls is the single most useful skill in color picking.
| Axis | What it controls | Practical effect |
|---|---|---|
| Hue (0β360Β°) | The pure color name: red, orange, yellow, green, blue, purple. | Carries meaning and emotion. Changing hue changes the message. |
| Saturation (0β100%) | How vivid or muted the color is. 0% = gray, 100% = pure color. | High saturation grabs attention. Low saturation feels calm and professional. |
| Lightness (0β100%) | How close to black (0%) or white (100%) the color is. | Drives contrast and readability. The single biggest legibility lever. |
Choosing a background color
Backgrounds set the mood for everything painted on top. They should usually be the most desaturated, lowest-contrast elements, leaving room for text and accents to do the work.
- Good for long reading: off-white (β98% lightness, 0β5% saturation) or deep ink (β10β15% lightness) for dark mode. They cause less eye strain than pure white or pure black.
- Good for dashboards and dense UI: a slightly cool neutral such as
#f8fafc(slate-50) prevents data colors from clashing. - Avoid: highly saturated backgrounds for any screen the user reads from for more than a few seconds. They tire the eyes and crush the saturation budget you have for accents.
- Avoid: pure
#ffffffon high-brightness OLED displays for night-time apps β it can feel painfully bright.
Choosing a text color
Text color is the most demanding job for color: it must read at small sizes, in bulk, often for minutes at a time. Lightness contrast against the background dominates everything else.
- Good for body text on light backgrounds: a dark slate or navy such as
#111827or#1f2937. Pure black on pure white can feel harsh; a slight color cast is gentler. - Good for body text on dark backgrounds: a soft off-white such as
#e5e7ebrather than pure white, again to avoid harshness. - Good for secondary text: a muted gray that still meets AA (4.5:1). Donβt go below AA just to de-emphasize.
- Avoid: mid-saturation hues at mid-lightness for body text (e.g. medium blue, medium green). They almost never reach AA contrast on white or dark backgrounds.
- Avoid: light gray on white as a label or hint. If users have to lean in, the design has failed.
Choosing an accent or brand color
Accent colors carry attention and identity. The same hue can be warm and energetic or cold and corporate depending on saturation and lightness. Restraint is more valuable than novelty.
- Good for trust and stability: blues in the 200Β°β230Β° range, moderate saturation. Common in finance, healthcare, and infrastructure products.
- Good for energy and growth: oranges and greens. Use them as small splashes, not as backgrounds.
- Good for premium feel: dark, low-saturation accents (deep teal, slate, eggplant) on near-white backgrounds. The space around the color does the work.
- Avoid: two highly saturated accent colors on the same screen. They fight for attention and feel cheap.
- Avoid: pure red, pure yellow, or pure green for non-state elements β users associate them with errors, warnings, and success. Reserve those hues for status.
Status colors: success, warning, error, info
Status colors are conventions, not opinions. Users have learned them from operating systems and the web for decades. Honoring those conventions is more important than originality.
| State | Recommended hue | Common pitfall |
|---|---|---|
| Success | Green (~120Β°β145Β°), moderate saturation, mid-dark lightness. | Pure neon green looks toxic and fails contrast on white. |
| Warning | Amber/orange (~30Β°β45Β°). Avoid pure yellow on white β too low contrast. | Yellow text is rarely legible; use yellow as fill behind dark text. |
| Error | Red (~0Β°β15Β°), saturated but darkened (β€55% lightness on white). | Pink-leaning reds feel decorative and weaken urgency. |
| Info | Blue (~200Β°β220Β°), moderate saturation. Easy to confuse with primary brand color. | Reuse the brand blue only if you are sure info and primary won't appear together. |
Building a small palette that holds together
Most product UIs need fewer colors than designers think. A workable starting palette: one neutral background, one neutral text, one accent, plus four status colors. That is seven colors, which is plenty.
- Pick the neutral first. Off-white or very-light-gray for light mode. Deep slate for dark mode. Keep saturation under 5%.
- Pick the accent next. Choose a hue that survives the contrast check against the neutral at text-sized weights.
- Generate a scale. For each color, derive 5β10 shades by varying lightness in roughly 10% steps. This gives you hover, pressed, disabled, and surface variants without inventing new colors.
- Avoid: picking colors one component at a time. The palette feels noisy because it is.
Color harmony: combining hues
Classic color theory describes a few reliable hue relationships. They are starting points, not laws β every successful palette also tunes saturation and lightness.
| Relationship | How to find it | Best for |
|---|---|---|
| Monochromatic | Single hue, vary saturation and lightness. | Calm, cohesive UIs. Hard to mess up. |
| Analogous | Hues within ~30Β° of each other on the wheel. | Soft, harmonious feel. Marketing pages, illustrations. |
| Complementary | Hues 180Β° apart (e.g. blue + orange). | Strong contrast for accents. Use sparingly. |
| Triadic | Three hues evenly spaced (120Β° apart). | Charts and dashboards needing distinct categorical colors. |
Accessibility: not optional
Roughly 8% of men and 0.5% of women have some form of color vision deficiency. A meaningful share of users also browse on low-quality screens, in sunlight, or with vision impairments. Accessibility is the floor, not the ceiling.
- Always pair color with another signal. Icons, text, weight, or position. Red text alone for an error fails for red-green color blindness.
- Verify contrast. AA (4.5:1 for body, 3:1 for large text) is the minimum. AAA (7:1) is appropriate for long-form reading.
- Test in grayscale. If a chart or dashboard still works without color, it is robust. If it falls apart, redesign before shipping.
- Avoid red/green as the only difference in data visualization. Use blue/orange or shape encoding instead.
Common mistakes and how to fix them
A few patterns show up in nearly every internal design review.
- Too many saturated colors. Fix: keep saturated colors for status and one accent. Make everything else neutral.
- Light gray text on white. Fix: darken until it passes AA. Resist the urge to use opacity instead β that produces unpredictable contrast.
- Pure black on pure white. Fix: soften both β
#111827on#fafafareads more like print. - Brand color reused as the error color. Fix: error needs to feel different from anything decorative. Pick a dedicated red.
- Charts with similar mid-tones. Fix: vary lightness across the series, not just hue. The eye reads lightness faster than hue.
A short workflow
When picking a color in this tool, a fast workflow that usually produces good results:
- Decide the job first: background, body text, accent, or status.
- Pick lightness for that job: high for backgrounds, low for text on light backgrounds, mid for accents.
- Pick saturation: low for neutrals, moderate for accents, higher only for true status.
- Pick hue last. Hue carries emotion but rarely solves a legibility problem.
- Check contrast against the surface it will sit on. If it fails, change lightness, not hue.