Color Theory for Web Designers: A Practical Guide
Color theory for the web comes down to three controls and one decision. The controls are hue, saturation (chroma) and lightness; the decision is how far apart to set colors on each. Fix lightness first, choose hues with a harmony rule second, and build every hue as a ramp in OKLCH, a CSS color space whose lightness tracks how bright colors look.
That ordering is the main idea of this guide, and most of what follows explains why it works. Painters learned color with pigments on a wheel. Screen designers work with light, numbers and browsers, and a few classic rules behave differently once colors become CSS values. The sections below cover the wheel and harmony rules, why HSL misleads and OKLCH helps, what "out of gamut" means for your swatches, and a worked method for turning one brand hue into a production palette. Measured values throughout come from converting OKLCH to sRGB and computing the result, so you can check each one.
Readability rules (contrast ratios, focus rings, approved text pairs) live in a separate article: the accessible color systems guide covers them in detail. This page stays with how colors relate to each other and how to generate them.
The three properties, and which one matters most
Every screen color can be described by three properties.
- Hue is the color family: the angle around a wheel, from red through yellow, green, blue and violet back to red.
- Saturation, or chroma in OKLCH, is intensity: how far the color sits from a neutral gray of the same lightness.
- Lightness is how light or dark the color appears, from black to white.
Of the three, lightness does the most work in an interface. Hierarchy, legibility, depth, and the difference between a surface and the text on it all come from lightness differences. Hue mostly carries identity and meaning (brand, success, danger), and chroma carries emphasis.
A quick test makes this concrete. Convert a screenshot of your design to grayscale. Every distinction that survives the conversion is a lightness distinction. Anything that collapses into the same gray was relying on hue alone, which is fragile for readers with color vision deficiencies and for anyone looking at a dim or washed-out screen. Designers who say a palette "feels muddy" are usually describing several colors at nearly the same lightness. Pull them apart vertically, keep the hues, and the muddiness often disappears.
Temperature is a looser idea worth knowing. Reds, oranges and yellows are conventionally called warm and blues, greens and violets cool. The associations people attach to them (energy for warm, calm for cool) are cultural conventions, not rules, and they shift with context: a pale blue reads differently on a hospital site than on a gaming site. Treat temperature as a vocabulary for discussing a palette, not a formula for choosing one.
Which color wheel? Three wheels give three answers
Harmony rules are defined by positions on a wheel, so it matters which wheel you use. Designers meet three of them:
| Wheel | Primaries | Where you meet it | Complement of blue |
|---|---|---|---|
| Painter's wheel (RYB) | Red, yellow, blue | Art school, traditional color theory | Orange |
| HSL hue wheel | Red, green, blue light | Color pickers, CSS hsl() | Yellow (240 degrees + 180 = 60) |
| OKLCH hue wheel | Perceptual, from Oklab | CSS oklch(), modern palette tools | Roughly amber (264 + 180 = 84) |
The HSL answer follows directly from the arithmetic: pure blue is hue 240 in hsl(), and the opposite angle, 60, is pure yellow. The OKLCH answer comes from the CSS Color 4 specification, which gives sRGB blue as oklch(0.452 0.313 264.1); adding 180 degrees lands near hue 84, an amber-to-gold region. The painter's wheel puts orange opposite blue.
None of these is wrong. They are different maps. The practical consequence is that "complementary" is not a single color pair you can look up. Pick one wheel for a project, preferably the one your tools use for generating colors, and apply harmony rules on that wheel consistently. OKLCH hue angles also differ from HSL angles for the same color, as MDN points out: hsl() red at 0 degrees converts to an OKLCH hue of about 29. Do not copy hue numbers between the two systems.
Harmony rules, translated into hue angles
Harmony rules describe angle relationships. Expressed as angles on the OKLCH wheel, with a blue primary at hue 260, they look like this:
| Scheme | Hue angles (from 260) | Character | Good fit |
|---|---|---|---|
| Monochromatic | 260 only, varied lightness and chroma | Quiet, unified | Dashboards, documentation, data-heavy products |
| Analogous | 230, 260, 290 | Cohesive, low tension | Content sites, editorial brands |
| Complementary | 260 and 80 | High tension, strong accent | One call-to-action color against a calm base |
| Split-complementary | 260, 50 and 110 | Contrast with less clash | Marketing pages that need two accents |
| Triadic | 260, 20 and 140 | Lively, hard to balance | Illustration, playful brands, kids' products |
At a shared lightness of 0.62 and chroma of 0.12, the analogous set renders as #1292C0, #5A86CE and #8678C9; the complement at hue 80 renders as #AC7D1B. You can paste those into any tool to see the schemes side by side.
Three practical notes keep these schemes from going wrong in interfaces:
- Proportion matters more than the angles. A complementary scheme with equal areas of blue and amber looks restless. The same two hues with blue across most of the interface and amber on a single button look intentional. One dominant hue, with others in supporting amounts, works for almost every scheme.
- Harmony rules ignore lightness. Two complementary colors at the same lightness and high chroma can produce a vibrating edge where they meet. Separating them in lightness, or desaturating one, calms the boundary without abandoning the hue relationship.
- Neutrals are not part of the wheel, but they are most of the screen. Tint your grays very slightly toward the primary hue (an OKLCH chroma around 0.003 to 0.02) and the palette feels related even when the accent colors are few.
Why HSL lightness misleads
HSL is the format most designers learned first, and its numbers look intuitive: hue in degrees, saturation and lightness in percentages. The problem is that the lightness number does not match what people see. The CSS Color Module Level 4 specification explains that HSL lightness is simply the mean of the gamma-corrected red, green and blue components, so it does not correspond to perceived lightness across hues. Its own example contrasts blue and yellow, both at 50% HSL lightness, where the yellow looks far lighter.
You can quantify that gap with the luminance calculation used for contrast. Pure yellow (#FFFF00) and pure blue (#0000FF) are both hsl(... 100% 50%). Against white, yellow measures about 1.07:1 and blue about 8.59:1. Same HSL lightness, opposite ends of the readability scale.
This is why HSL-generated palettes need hand correction. If you build a nine-step ramp for yellow and another for blue by stepping HSL lightness in equal increments, the yellow ramp will look washed out at the middle steps while the blue ramp still looks dark. Teams then nudge values one by one until the steps look even, which is slow and hard to repeat for a new hue.
How OKLCH fixes the ramp problem
OKLCH is the cylindrical form of Oklab, which the CSS Color 4 specification describes as an improved Lab-like space derived numerically from a large dataset of visually similar colors. The specification lists better hue linearity, hue uniformity and chroma uniformity than CIE LCH. Its components are:
| Component | Range | Meaning |
|---|---|---|
| L (lightness) | 0 to 1, or 0% to 100% | 0 is black, 1 is diffuse white |
| C (chroma) | 0 upward; 100% equals 0.4 | 0 is gray; in practice values rarely exceed about 0.5 |
| H (hue) | Degrees, normalized to 0 to 360 | Hue angle on the Oklab wheel |
MDN lists oklch() as Baseline widely available, supported across major browsers since May 2023, and the current Tailwind CSS documentation defines its default palette in OKLCH, with 11 steps per hue named 50 through 950. For example, Tailwind's blue-500 is oklch(62.3% 0.214 259.815).
Because L tracks perceived lightness, stepping L evenly produces ramps that look evenly spaced across different hues. That is the main reason to author palettes in OKLCH even if you ship hex values.
The catch: equal lightness is not equal contrast
OKLCH lightness predicts how light a color looks. WCAG contrast is computed from relative luminance, which is a different quantity. They track each other closely but not exactly, and the difference shows up right around the 4.5:1 line where it matters most.
Here are seven hues all set to L 0.55 and chroma 0.10 in OKLCH, converted to sRGB, and measured against white:
| Hue (OKLCH angle) | Hex | Contrast with white |
|---|---|---|
| Red (25) | #A45953 | 5.08:1 |
| Orange (55) | #9E6033 | 5.03:1 |
| Amber (80) | #906A21 | 4.92:1 |
| Green (145) | #49814C | 4.64:1 |
| Blue (260) | #4E72AC | 4.85:1 |
| Violet (300) | #7B63A3 | 5.05:1 |
| Magenta (340) | #985984 | 5.13:1 |
All of them pass 4.5:1 for normal text, so a 0.55 lightness step makes a sensible "button fill with white text" level in a moderate-chroma palette. But the spread from 4.64 to 5.13 is real. Push chroma to the maximum each hue allows at L 0.55 and the spread widens: a fully saturated red reaches about 5.45:1 while a fully saturated green falls to about 4.52:1, a hair above the line. So use OKLCH lightness to build the ramp, then measure contrast on the actual colors before approving any text pair.
Gamut: when the color you typed cannot be shown
Chroma in OKLCH has no fixed ceiling, which means it is easy to write a color the screen cannot display. The sRGB gamut (the color range most monitors and the default web color space cover) is narrow at some hue and lightness combinations. The specification says out-of-gamut colors are still valid but must be gamut mapped for display, producing a similar-looking color with lower chroma.
How narrow is it? Here is the maximum chroma that stays inside sRGB for a few combinations, computed by converting OKLCH to linear sRGB and checking that every channel stays between 0 and 1:
| Lightness | Hue | Max in-gamut chroma | Resulting hex |
|---|---|---|---|
| 0.55 | 250 (sky blue) | about 0.155 | #0274C7 |
| 0.55 | 265 (blue) | about 0.248 | #275BFF |
| 0.55 | 80 (amber) | about 0.114 | #946900 |
| 0.55 | 145 (green) | about 0.173 | #008A23 |
| 0.55 | 25 (red) | about 0.223 | #D50022 |
| 0.80 | 80 (amber) | about 0.165 | #F5B005 |
Two things stand out. Chroma limits change a lot between neighboring hues (250 versus 265 differ by about 0.09). And amber is narrow at mid lightness and wider when light, which matches experience: rich mid-dark yellows barely exist in sRGB, so a dark "gold" tends to read as brown or olive.
An earlier version of this page used values such as oklch(0.55 0.22 250) for a blue button. That color sits well outside sRGB, so browsers on standard displays have to map it to something else, and different tools can land on different results. In-gamut values make the hex you document match what users see. Palette tools that show a gamut boundary make this easy; otherwise, lower chroma until the color stops shifting when you convert it to hex.
A worked palette: one brand hue to a full ramp
Inputs: a brand blue at OKLCH hue 260. Goal: an 11-step ramp matching the 50 to 950 naming convention, with every step inside sRGB.
Method: choose a lightness for each step, find the maximum in-gamut chroma at that lightness and hue, use 90% of it (capped at 0.20) to leave a margin, then convert.
| Step | L | C | Hex | Contrast with white | Typical job |
|---|---|---|---|---|---|
| 50 | 0.97 | 0.013 | #F0F5FE | 1.09:1 | Tinted page sections |
| 100 | 0.93 | 0.030 | #DCE9FD | 1.23:1 | Selected rows, info tints |
| 200 | 0.87 | 0.057 | #BFD6FB | 1.48:1 | Subtle fills, chart backgrounds |
| 300 | 0.80 | 0.090 | #9CBFF8 | 1.87:1 | Dark-theme text accents |
| 400 | 0.71 | 0.136 | #6EA1F6 | 2.60:1 | Dark-theme links and icons |
| 500 | 0.62 | 0.185 | #3C81F3 | 3.73:1 | Large text and icons on white |
| 600 | 0.55 | 0.200 | #1C69E3 | 5.02:1 | Primary buttons, links |
| 700 | 0.49 | 0.180 | #1559C4 | 6.45:1 | Hover and pressed states |
| 800 | 0.42 | 0.154 | #0F479F | 8.67:1 | Text on light blue tints |
| 900 | 0.36 | 0.132 | #0A3881 | 11.08:1 | Headings in brand color |
| 950 | 0.28 | 0.104 | #04255B | 14.78:1 | Dark-theme surfaces |
Notice the chroma curve: it peaks in the middle of the ramp and falls toward both ends. That is not a style choice. The sRGB gamut is narrowest near white and black, so a ramp that tried to keep chroma constant would leave the gamut at the light and dark ends. Tinted near-whites in particular can carry very little chroma (about 0.014 at L 0.97 for this hue) before they leave sRGB.
The lightness steps are not perfectly even either. They are wider in the middle (0.07 to 0.09) and narrower at the light end, because small lightness changes near white are easy to see as tints and the middle of the ramp needs room for the button, hover and text roles. Adjust the spacing to the jobs your product needs rather than to a fixed formula.
With the ramp built, the 800 step on the 100 step tint (#0F479F on #DCE9FD) measures about 7.07:1, so that pair can carry body text in a blue notice banner. Checks like that one go into the approved-pairs list described in the accessibility guide.
Repeat for the other roles
A typical product palette has these roles:
| Role | How many hues | Build notes |
|---|---|---|
| Primary | 1, full ramp | The worked example above |
| Neutral | 1, full ramp | Same hue as primary, chroma 0.003 to 0.02 |
| Success | 1, partial ramp | Green, around hue 145 |
| Warning | 1, partial ramp | Amber, around hue 80; expect lower chroma at mid lightness |
| Danger | 1, partial ramp | Red, around hue 25 |
| Info | Often reuses primary | A separate teal or cyan if primary is not blue |
| Accent | 0 or 1 | Only if a second brand color carries real meaning |
Reuse the primary's lightness values for every hue. When all ramps share L values, the 600 step of every hue has a similar visual weight, which makes a set of status badges or chart series look balanced. Then measure: the equal-lightness table above shows the amber and green 600 steps can sit closer to the 4.5:1 line than blue and red, so they may need to shift one step darker for text use.
The 60-30-10 split is a common heuristic for proportions: about 60% dominant color (usually neutrals), 30% secondary surfaces, 10% accent. It is a starting point for a layout review, not a measurement anyone needs to hit. Interfaces with lots of data often end up closer to 80% neutral.
From palette to CSS tokens
Tokens are named variables that components use instead of raw values. Defining them in OKLCH keeps the palette editable, and modern CSS adds relative color syntax so you can derive states from a base token. MDN documents the form oklch(from <color> l c h), where l, c and h resolve to numbers you can adjust in calc().
:root {
--blue-600: oklch(0.55 0.2 260); /* #1C69E3 */
--blue-700: oklch(0.49 0.18 260); /* #1559C4 */
--neutral-950: oklch(0.21 0.006 260);
--neutral-50: oklch(0.985 0.003 260);
--color-action: var(--blue-600);
--color-action-hover: var(--blue-700);
--color-text: var(--neutral-950);
--color-page: var(--neutral-50);
}
/* Derived state: 0.06 darker, same chroma and hue */
.button:active {
background: oklch(from var(--color-action) calc(l - 0.06) c h);
}
Two layers of tokens (raw ramp values, then role names such as color-action) let you rebrand by remapping roles without touching components. For the full token architecture, see the guide to building a design system from scratch.
Hover and pressed states are a good place to keep hue fixed and move only lightness. A hover that shifts hue as well as lightness can look like a different color rather than a state of the same one.
Edge cases where the simple method breaks
- Brand colors that are already out of gamut. If a brand guide specifies a vivid color defined for print or a wide-gamut display, its sRGB version will be a mapped approximation. Decide on the official sRGB value once and document it, rather than letting each tool map it differently. The CMYK vs RGB print color guide covers the print side of that conversion.
- Yellow and amber at mid lightness. As the gamut table shows, there is little chroma available. Accept a browner amber for text-bearing steps, and use the bright light yellows only as fills with dark text.
- Very dark steps. Near the dark end, the gamut leaves little chroma (about 0.10 at L 0.28 in the blue ramp above), so the 950 steps of different ramps can be hard to tell apart. That is fine for surfaces; do not rely on them for meaning.
- Data visualization. Categorical chart colors need equal lightness and different hues; sequential scales need even lightness steps. The chart color accessibility checklist covers both.
- Dark themes. A ramp built for light backgrounds is reused in reverse order, but the steps that work as text change. The dark mode design guide explains surface elevation and how to pick dark-theme accents.
Common mistakes
| Mistake | What happens | Better approach |
|---|---|---|
| Picking hues first, lightness later | Harmonious hues with no hierarchy | Set lightness roles, then choose hues |
| Stepping HSL lightness evenly | Uneven ramps across hues | Step OKLCH lightness, then check |
| High chroma values without a gamut check | Documented hex differs from what users see | Stay under the in-gamut chroma limit |
| Assuming equal OKLCH lightness means equal contrast | A green or amber text pair slips under 4.5:1 | Measure each pair |
| Copying hue angles between HSL and OKLCH | Wrong colors (red is 0 in HSL, about 29 in OKLCH) | Convert colors, not numbers |
| Adding a new hue for every new feature | A palette with no meaning | Add a hue only when it carries a new meaning |
FAQ
Is the RYB color wheel useless for web design?
No, it is still a good tool for thinking about mood and for illustration work, and many brand references are written with it in mind. It just does not match the hue angles in CSS. When a harmony rule from art training gives a result that looks off on screen, the cause is often the wheel, not the rule.
Should palettes be shipped as OKLCH or hex?
Either works in current browsers. Shipping OKLCH tokens keeps relative color syntax and wide-gamut options available. Shipping hex is simpler for tools that do not parse oklch(), such as some email clients and older design plugins. A common setup is authoring in OKLCH, documenting the hex equivalent next to each token, and generating whichever format each platform needs.
How many steps should each color ramp have?
Enough to cover the jobs you have. Eleven steps (50 to 950) is a widely recognized convention, but semantic colors often need only four or five: a tint background, a border, a text color, a solid fill and a hover. Unused steps add maintenance without adding value.
What chroma should neutrals have?
Low enough that they read as gray: in OKLCH, roughly 0.003 to 0.02. At zero they are perfectly neutral; a small amount of the primary hue makes them feel related to the brand. Past that range, check the light steps on a calibrated screen next to a pure gray, because the tint becomes visible sooner on near-white surfaces than on mid grays.
Why do my colors look different in Figma and the browser?
Usually a color profile mismatch. If the design file works in Display P3 and the browser renders sRGB, or the reverse, the same numbers produce different colors. Set the design file's color profile to match your target (sRGB for most web work) and compare hex values rather than screenshots.
References and check dates
- OKLCH definition, component ranges, gamut mapping and the HSL lightness critique come from the W3C CSS Color Module Level 4 draft dated 20 October 2026 (https://www.w3.org/TR/css-color-4/), checked October 22, 2026.
- Syntax, relative color form, hue-angle differences and Baseline status for oklch() come from MDN (https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch), checked October 22, 2026.
- The 11-step 50 to 950 naming and the blue-500 value come from the Tailwind CSS colors page (https://tailwindcss.com/docs/colors), checked October 22, 2026.
- The luminance math behind every contrast figure follows W3C's 1.4.3 explainer (https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html), checked October 22, 2026.
Hex conversions, gamut limits and contrast values on this page were computed by the Lucky Graphics editorial team from the OKLCH values shown, using the Oklab to sRGB conversion and the WCAG luminance formula.
Where to go from here
Once the ramps exist, the next job is deciding which pairs may carry text. The walkthrough of tested foreground and background pairs takes the palette built here through buttons, inputs, focus rings and a dark theme, with a measured ratio for every approved combination.