Essential tools for working with color and quick reference charts for common tasks.
Palette Generators
| Tool | Best For | URL |
|---|
| Coolors | Quick palette generation | coolors.co |
| Adobe Color | Harmony-based palettes | color.adobe.com |
| Realtime Colors | Preview on actual UI | realtimecolors.com |
| Huemint | AI-generated palettes | huemint.com |
| Khroma | AI learns your preferences | khroma.co |
Color Scale Generators
| Tool | Best For | URL |
|---|
| Tailwind CSS Colors | Copy pre-made scales | tailwindcss.com/docs/customizing-colors |
| Radix Colors | Accessible scales | radix-ui.com/colors |
| Open Color | Open source palette | yeun.github.io/open-color |
| ColorBox | Custom scale generation | colorbox.io |
| Leonardo | Contrast-based scales | leonardocolor.io |
Contrast Checkers
| Tool | Best For | URL |
|---|
| WebAIM Contrast Checker | Quick checks | webaim.org/resources/contrastchecker |
| Contrast Ratio | Clean interface | contrast-ratio.com |
| Coolors Contrast Checker | Integrated with palettes | coolors.co/contrast-checker |
| Who Can Use | Shows who's affected | whocanuse.com |
Color Blindness Simulators
| Tool | Best For | URL |
|---|
| Coblis | Upload images | color-blindness.com/coblis |
| Sim Daltonism | macOS app | michelf.ca/projects/sim-daltonism |
| Chrome DevTools | Built into browser | (Rendering → Emulate vision deficiencies) |
| Stark | Figma/Sketch plugin | getstark.co |
Chrome/Edge
Access color contrast:
- Inspect element
- Elements panel → Styles
- Click color swatch
- Contrast ratio shown at bottom
Simulate color blindness:
- DevTools → Three dots → More tools → Rendering
- Scroll to "Emulate vision deficiencies"
- Select deficiency type
Pick colors from page:
- Click any color swatch in Styles
- Use eyedropper tool
- Shift+Click swatch to cycle formats
Firefox
Accessibility Inspector:
- DevTools → Accessibility tab
- Check contrast issues automatically
- Simulate color vision deficiencies
Figma
| Plugin | Purpose |
|---|
| Stark | Accessibility checker, contrast, simulation |
| Color Blind | Simulate color blindness |
| Contrast | Quick contrast checking |
| Chroma Colors | Generate accessible palettes |
| A11y - Color Contrast Checker | WCAG compliance |
Sketch
| Plugin | Purpose |
|---|
| Stark | Full accessibility suite |
| Sketch Palettes | Import/export palettes |
| Color Contrast Analyzer | WCAG checking |
Quick Reference Charts
HSL Hue Values
0° / 360° Red
30° Orange
60° Yellow
90° Yellow-Green
120° Green
150° Teal
180° Cyan
210° Sky Blue
240° Blue
270° Purple
300° Magenta
330° Pink
Contrast Ratio Requirements
| Element | AA Minimum | AAA |
|---|
| Normal text (<18px) | 4.5:1 | 7:1 |
| Large text (≥18px) | 3:1 | 4.5:1 |
| UI components | 3:1 | - |
| Graphics | 3:1 | - |
Common Color Values
/* Pure colors at max saturation */
--red: hsl(0, 100%, 50%);
--orange: hsl(30, 100%, 50%);
--yellow: hsl(60, 100%, 50%);
--green: hsl(120, 100%, 50%);
--cyan: hsl(180, 100%, 50%);
--blue: hsl(240, 100%, 50%);
--purple: hsl(270, 100%, 50%);
--magenta: hsl(300, 100%, 50%);
/* Common UI-friendly values */
--ui-blue: hsl(220, 80%, 50%);
--ui-green: hsl(142, 70%, 45%);
--ui-red: hsl(0, 75%, 50%);
--ui-yellow: hsl(45, 90%, 50%);
--ui-purple: hsl(270, 60%, 55%);
/* Starting from --base-hue */
/* Complementary */
--complement: calc(var(--base-hue) + 180);
/* Analogous */
--analogous-1: calc(var(--base-hue) - 30);
--analogous-2: calc(var(--base-hue) + 30);
/* Triadic */
--triadic-1: calc(var(--base-hue) + 120);
--triadic-2: calc(var(--base-hue) + 240);
/* Split-complementary */
--split-1: calc(var(--base-hue) + 150);
--split-2: calc(var(--base-hue) + 210);
/* Square */
--square-1: calc(var(--base-hue) + 90);
--square-2: calc(var(--base-hue) + 180);
--square-3: calc(var(--base-hue) + 270);
Standard Semantic Colors
:root {
/* Success (Green) */
--success-hue: 142;
--success: hsl(142, 70%, 45%);
/* Warning (Yellow/Amber) */
--warning-hue: 38;
--warning: hsl(38, 90%, 50%);
/* Error (Red) */
--error-hue: 0;
--error: hsl(0, 75%, 50%);
/* Info (Blue) */
--info-hue: 210;
--info: hsl(210, 80%, 50%);
}
Typography Color Guidelines
:root {
/* Light mode */
--text-primary: hsl(220, 15%, 15%); /* Headings */
--text-secondary: hsl(220, 10%, 40%); /* Body */
--text-muted: hsl(220, 10%, 55%); /* Captions */
--text-disabled: hsl(220, 10%, 70%); /* Disabled */
/* Dark mode */
--dark-text-primary: hsl(220, 15%, 92%);
--dark-text-secondary: hsl(220, 10%, 68%);
--dark-text-muted: hsl(220, 10%, 52%);
--dark-text-disabled: hsl(220, 10%, 38%);
}
Dark Mode Background Scale
:root {
/* Elevation levels (dark mode) */
--dark-0: hsl(220, 15%, 8%); /* Page background */
--dark-1: hsl(220, 15%, 12%); /* Cards */
--dark-2: hsl(220, 15%, 16%); /* Raised cards */
--dark-3: hsl(220, 15%, 20%); /* Modals */
--dark-4: hsl(220, 15%, 24%); /* Dropdowns */
--dark-5: hsl(220, 15%, 28%); /* Tooltips */
}
CSS Color Functions
Modern CSS (Wide Support)
/* HSL */
color: hsl(220, 80%, 50%);
color: hsl(220 80% 50%); /* Space-separated */
color: hsl(220 80% 50% / 50%); /* With alpha */
/* RGB */
color: rgb(59, 130, 246);
color: rgb(59 130 246); /* Space-separated */
color: rgb(59 130 246 / 50%); /* With alpha */
/* HEX */
color: #3b82f6;
color: #3b82f680; /* With alpha (8 digits) */
Newer CSS (Check Support)
/* OKLCH - perceptually uniform */
color: oklch(60% 0.15 250);
/* LCH */
color: lch(50% 100 270);
/* color-mix() - blend colors */
color: color-mix(in srgb, #3b82f6, white 20%);
/* relative color syntax */
color: hsl(from var(--primary) h s calc(l + 20%));
JavaScript Color Utilities
Convert HEX to RGB
function hexToRgb(hex) {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
Convert RGB to HSL
function rgbToHsl(r, g, b) {
r /= 255; g /= 255; b /= 255;
const max = Math.max(r, g, b), min = Math.min(r, g, b);
let h, s, l = (max + min) / 2;
if (max === min) {
h = s = 0;
} else {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
case g: h = ((b - r) / d + 2) / 6; break;
case b: h = ((r - g) / d + 4) / 6; break;
}
}
return {
h: Math.round(h * 360),
s: Math.round(s * 100),
l: Math.round(l * 100)
};
}
Calculate Relative Luminance
function getLuminance(r, g, b) {
const [rs, gs, bs] = [r, g, b].map(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;
}
Calculate Contrast Ratio
function getContrastRatio(rgb1, rgb2) {
const l1 = getLuminance(rgb1.r, rgb1.g, rgb1.b);
const l2 = getLuminance(rgb2.r, rgb2.g, rgb2.b);
const lighter = Math.max(l1, l2);
const darker = Math.min(l1, l2);
return (lighter + 0.05) / (darker + 0.05);
}
Darken/Lighten HSL Color
function adjustLightness(hsl, amount) {
return {
h: hsl.h,
s: hsl.s,
l: Math.max(0, Math.min(100, hsl.l + amount))
};
}
// Usage
const base = { h: 220, s: 80, l: 50 };
const darker = adjustLightness(base, -10); // l: 40
const lighter = adjustLightness(base, 10); // l: 60
Checklist: Color in a New Project
Planning
- [ ] Define brand color(s)
- [ ] Choose color harmony (complement, split, etc.)
- [ ] Plan semantic colors (success, warning, error)
- [ ] Decide on neutral tint (warm, cool, brand)
Building
- [ ] Generate 50-950 scale for each color
- [ ] Create tinted neutral scale
- [ ] Define semantic tokens (bg-primary, text-secondary, etc.)
- [ ] Set up light/dark mode variables
Accessibility
- [ ] Test all text contrast (4.5:1 minimum)
- [ ] Test UI component contrast (3:1 minimum)
- [ ] Simulate color blindness
- [ ] Verify focus states are visible
- [ ] Ensure color isn't the only indicator
Implementation
- [ ] Set up CSS custom properties
- [ ] Create dark mode variant
- [ ] Document color usage guidelines
- [ ] Test on multiple devices/screens
Further Learning
Books
- Interaction of Color by Josef Albers
- Color and Light by James Gurney
- Designing with Color by Chris Cosgrove
Courses
- Coursera: Fundamentals of Graphic Design (color module)
- Skillshare: Color Theory for Designers
Specifications
- WCAG 2.1: w3.org/WAI/WCAG21/quickref (contrast requirements)
- CSS Color Level 4: w3.org/TR/css-color-4
Summary: The Essential Rules
- Use HSL for color manipulation
- Start with neutrals - they're 70-80% of your UI
- Limit hues - 1-2 plus semantic colors
- Test contrast - 4.5:1 for text, 3:1 for UI
- Never color alone - add icons, text, patterns
- Desaturate for dark mode - and adjust lightness
- Create scales - not individual colors
- Use semantic tokens - not raw values
- Test with users - including colorblind simulation
- Keep it simple - restraint creates impact