TL;DR: Start with one color you love. Generate tints and shades using HSL lightness. Follow the 60-30-10 rule (background/surface/accent). Add semantic colors for success/error/warning. Check contrast ratios for accessibility. Done — you have a professional palette.
Color is the first thing visitors notice about your website. Before they read a single word, their brain has already decided whether your site feels trustworthy, playful, corporate, or sketchy — and that snap judgment is mostly based on color.
Yet so many developers treat color as an afterthought, grabbing random hex values until something "looks okay enough." I have been there. We have all been there. The good news? You do not need an art degree to pick great colors. You just need a system.
Picking website colors without a system is like grocery shopping when you are hungry. You end up with 14 different things that do not go together.
Color Theory in 60 Seconds
You do not need to memorize a textbook. Here are the three concepts that actually matter:
The Color Wheel
Colors arranged in a circle: red, orange, yellow, green, blue, violet, and back to red. The position of colors relative to each other tells you which combos will look good together.
Harmony Patterns (a.k.a. "Cheat Codes")
- Complementary: Two colors across from each other (blue + orange). High energy, great for CTA buttons.
- Analogous: Three neighbors on the wheel (blue, teal, green). Calm, cohesive, hard to mess up.
- Monochromatic: One hue, different lightness/saturation levels. Elegant and literally impossible to get wrong.
- Triadic: Three colors equally spaced (red, yellow, blue). Vibrant and balanced.
Warm vs. Cool
Warm colors (red, orange, yellow) feel energetic and inviting. Cool colors (blue, green, violet) feel calm and professional. Most web designs use a cool or neutral base with warm accent colors for buttons and calls to action. It is like a well-dressed person in a navy suit with a bold pocket square.
The 60-30-10 Rule
This is a classic interior design trick that works beautifully for websites:
- 60% — Dominant color (your background, large surfaces)
- 30% — Secondary color (cards, sidebars, sections)
- 10% — Accent color (buttons, links, highlights)
:root {
--color-bg: #f8f9fa; /* 60% - dominant */
--color-surface: #ffffff; /* 30% - secondary */
--color-primary: #3498db; /* 10% - accent */
--color-text: #2c3e50;
--color-text-muted: #7f8c8d;
}
Building Your Palette, Step by Step
Step 1: Pick ONE Color
Just one. Your primary brand color, or a color that matches the mood you are going for. Stuck? Blue is the safest default — it conveys trust and is the most universally liked color across cultures.
Step 2: Generate Tints and Shades
Using HSL, this is comically easy. Keep the hue and saturation the same, just slide the lightness up and down:
--primary-50: hsl(204, 70%, 95%); /* barely there */
--primary-200: hsl(204, 70%, 80%);
--primary-500: hsl(204, 70%, 53%); /* your base */
--primary-700: hsl(204, 70%, 33%);
--primary-900: hsl(204, 70%, 13%); /* deep and dark */
Step 3: Pick Your Neutrals
Neutrals (grays) make up most of any interface — text, borders, backgrounds, dividers. Pure gray can feel lifeless, so add a tiny tint of your primary color to warm things up:
--gray-100: hsl(204, 10%, 96%);
--gray-500: hsl(204, 8%, 52%);
--gray-900: hsl(204, 12%, 12%);
Step 4: Add Semantic Colors
Every web app needs success (green), warning (orange), error (red), and info (blue) colors. These are non-negotiable:
--color-success: hsl(145, 63%, 42%);
--color-warning: hsl(36, 100%, 50%);
--color-error: hsl(4, 90%, 58%);
--color-info: hsl(204, 70%, 53%);
Accessibility: Not Optional, Not Hard
Here is the deal: about 8% of men are color blind, and many people browse in challenging lighting conditions. Color contrast is not just nice-to-have — it is a legal requirement in many contexts.
WCAG defines minimum contrast ratios:
- AA (minimum): 4.5:1 for normal text, 3:1 for large text
- AAA (enhanced): 7:1 for normal text, 4.5:1 for large text
Common contrast fails: light gray text on white, colored text on colored backgrounds, and placeholder text that is basically invisible. When in doubt, check with a contrast tool before you ship.
You can check contrast ratios with this JavaScript snippet:
function luminance(r, g, b) {
const [rs, gs, bs] = [r, g, b].map(c => {
c = c / 255;
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
});
return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
}
function contrastRatio(rgb1, rgb2) {
const l1 = luminance(...rgb1);
const l2 = luminance(...rgb2);
const lighter = Math.max(l1, l2);
const darker = Math.min(l1, l2);
return (lighter + 0.05) / (darker + 0.05);
}
// White text on blue background
contrastRatio([255,255,255], [52,152,219]);
// ~3.1 — fails AA for small text!
Dark Mode: More Than Just Inverting Colors
- Use dark grays, not pure black.
#121212is easier on the eyes than#000000. - Reduce saturation slightly. Vivid colors on dark backgrounds feel like staring at a neon sign.
- Maintain contrast ratios. Swap scales but verify with a checker tool.
- Use CSS custom properties with a
[data-theme="dark"]selector to swap palettes cleanly.
Mistakes That Will Haunt You
- Too many colors. Limit to 1-2 brand colors plus neutrals. Five accent colors create visual chaos that would make a circus jealous.
- Ignoring color blindness. Never use red vs. green as the only way to show success vs. error. Always pair with icons or text labels.
- Hardcoding colors. Always use CSS variables. When the brand palette changes (it will), you want to update in one place, not 347 places.
- Skipping real-world testing. Colors that look great as swatches can completely fall apart applied to real buttons, cards, and forms.
Quick trick: screenshot your site in progress and squint at it. If you can still tell apart the important elements, your color hierarchy is working. If everything blurs together, you need more contrast between sections.
Picking good colors is a learnable skill, not a gift you are born with. Start with one color, build a systematic palette, check your contrast ratios, and test on real components. You will develop an eye for it faster than you think.
Try It Yourself
Experiment with colors visually and grab the exact HEX, RGB, and HSL values you need for your project.
Open Color Picker →