Practical Guide

Color Palette Generator — Usage Guide and Technical Principles

Generate harmonious color palettes from base color with accessibility checks

Open tool

Overview

Color harmony is the theory of combining colors in aesthetically pleasing and effective ways. It's based on the color wheel and mathematical relationships between hues. Monochromatic schemes use variations of a single hue with different saturations and lightness. Complementary colors are opposite on the color wheel, creating high contrast and visual interest. Triadic schemes use three evenly spaced colors, while tetradic uses four colors in two complementary pairs. Analogous colors are adjacent on the wheel, creating serene and comfortable designs. These relationships ensure visual balance, readability, and emotional impact in design while maintaining accessibility through proper contrast ratios.

Key concepts

Color Models

Colors are represented using different models: RGB (Red, Green, Blue) for screens uses additive mixing with 0-255 values per channel. HSL (Hue 0-360°, Saturation 0-100%, Lightness 0-100%) is intuitive for color manipulation. HSV/HSB (Hue, Saturation, Value/Brightness) is used in color pickers. CMYK (Cyan, Magenta, Yellow, Key/Black) for printing uses subtractive mixing. Conversions between models use mathematical formulas. HEX (#RRGGBB) is RGB in hexadecimal. Lab and LCH are perceptually uniform color spaces for accurate color differences.

Color Harmony Theory

Color harmony is based on the 12-spoke color wheel with primary (red, yellow, blue), secondary (orange, green, purple), and tertiary colors. Complementary colors are 180° apart (e.g., blue-orange). Triadic uses 120° spacing (equilateral triangle). Tetradic uses two complementary pairs (rectangle or square). Analogous uses adjacent colors (30-60° apart). Split-complementary uses base color plus two adjacent to its complement. These relationships are calculated using hue rotation in HSL space while maintaining saturation and lightness or adjusting for visual balance.

Contrast Ratio Calculation

WCAG contrast ratio measures readability between foreground and background colors. Formula: (L1 + 0.05) / (L2 + 0.05) where L is relative luminance calculated from RGB: L = 0.2126*R + 0.7152*G + 0.0722*B (with gamma correction). Ratios range from 1:1 (same color) to 21:1 (black on white). Requirements: AA level requires 4.5:1 for normal text, 3:1 for large text (18pt+) and UI components; AAA requires 7:1 and 4.5:1 respectively. Tools must test all color combinations in palette for accessible pairings.

Palette Generation Algorithms

Generating palettes involves HSL manipulation for consistent results. Monochromatic: vary lightness (e.g., 20%, 40%, 60%, 80%) while keeping hue and saturation constant. Shades: reduce lightness toward 0% (black). Tints: increase lightness toward 100% (white). Tones: reduce saturation toward 0% (gray). For harmony schemes, rotate hue mathematically: complementary adds 180°, triadic adds 120° and 240°, analogous adds ±30°. Advanced generators adjust saturation and lightness for visual balance, avoiding overly dark or light colors. Bezier gradients create smooth color ramps between endpoints.

Features

Multiple Color Schemes

Generate monochromatic, complementary, analogous, triadic, tetradic, split-complementary palettes based on color theory with automatic hue, saturation, lightness calculations

WCAG Accessibility

Validate contrast ratios between colors against WCAG AA (4.5:1 text, 3:1 UI) and AAA (7:1 text, 4.5:1 UI) standards with pass/fail indicators for each color pair

Shades, Tints, Tones

Generate color variations: shades (adding black), tints (adding white), tones (adding gray) with customizable steps for complete color ramps and gradients

Multi-Format Export

Export palettes as CSS custom properties (--color-primary), SCSS variables ($color-primary), JSON objects, Tailwind config for seamless integration into projects

Use Cases

Development workflow

Use Color Palette Generator during implementation to generate, inspect, format, or verify technical assets without switching to heavier project tooling.

Code review and cleanup

Color Palette Generator helps review copied snippets, generated files, configuration fragments, and implementation details before they are committed or shared.

Technical documentation

Turn practical examples from Color Palette Generator into clearer pull requests, runbooks, onboarding notes, and API or SDK documentation.

Frequently Asked Questions

How can I quickly generate different palette styles?

Choose a base color and switch among monochromatic, complementary, triadic, tetradic, or analogous modes. Each harmony rotates hue in HSL space and adjusts saturation and lightness to deliver 4–12 colors. Fine-tune the color count or ramp steps for instant variations.

How does the tool calculate accessibility contrast?

Every color is converted to linear RGB to compute relative luminance, then the WCAG contrast formula (L1 + 0.05) / (L2 + 0.05) is applied. Combinations falling below AA/AAA thresholds are flagged as "Fail" so you can address readability before design handoff.

Which export formats are available?

You can export CSS custom properties, SCSS variables, JSON tokens, Tailwind extensions, Ant Design tokens, Material UI themes, and Figma-compatible JSON. Switch the tab in Export Code and copy or download the snippet you need.

How do I use the Tailwind config export?

Copy the generated Tailwind block into the `extend.colors` section of your `tailwind.config.ts` (or `.js`). Rebuild Tailwind (for example `npm run dev` or `npm run build`) to use the new color keys in your utility classes.

Related Documents

Color Palette Generator

Open the tool to try these features.

Open tool