Color Palette Generator
Generate harmonious color palettes based on color theory for web design, UI/UX, and creative projects.
Palette Settings
Generated Palette
Base
#3B82F6Complementary
#F6AF3BDarker
#0A59DALighter
#84B1F9Comp. Darker
#DA8B0APalette Preview
CSS Variables
:root {
--color-1: #3b82f6;
--color-2: #f6af3b;
--color-3: #0a59da;
--color-4: #84b1f9;
--color-5: #da8b0a;
}What Is a Color Palette Generator?
A color palette generator is a tool that applies color theory principles to automatically produce a set of harmonious colors from a single starting hue. Instead of guessing which colors complement each other, you pick one base color and let the generator derive the rest using mathematically defined relationships on the color wheel. The result is a ready-to-use palette for web design, UI/UX work, branding, illustration, or any creative project that requires consistent, visually balanced colors.
This color palette generator works entirely in the HSL (Hue, Saturation, Lightness) color space. Because HSL separates the hue angle from brightness and saturation, shifting colors by precise degrees on the color wheel is straightforward arithmetic — a fact that makes it the preferred model for programmatic palette generation. The tool accepts any hex color as input, converts it to HSL internally, applies the chosen harmony rule, then converts the resulting HSL values back to hex codes you can copy directly into CSS, design software, or code.
Six palette types are available: Complementary, Analogous, Triadic, Tetradic (Square), Split Complementary, and Monochromatic. Each type produces a distinct visual mood and serves different design goals. The tool also exports the palette as CSS custom properties (--color-1, --color-2, etc.) so you can paste the snippet directly into a stylesheet with zero manual work.
The HSL Color Model and HEX Conversion
Every palette calculation in this tool begins by converting your hex input to HSL. The hex string is split into three pairs of hexadecimal digits representing the red, green, and blue channels, each normalized to the 0–1 range. From those normalized RGB values the tool derives Hue (H), Saturation (S), and Lightness (L).
Lightness is the average of the largest and smallest channel values. Saturation depends on lightness: when L is greater than 0.5 the divisor is 2 − max − min; otherwise it is max + min. Hue is determined by which channel holds the maximum value and is expressed in degrees from 0° to 360°.
Converting back from HSL to HEX uses the chroma–intermediate method. The chroma C and intermediate value X together define the RGB sector, and the match offset m shifts all three channels to the correct lightness level. The final R, G, B values are each multiplied by 255 and rounded before being formatted as two-digit hex pairs.
HSL to HEX Intermediate Conversion
Where:
- H= Hue in degrees (0–360)
- S= Saturation as a decimal (0–1)
- L= Lightness as a decimal (0–1)
- C= Chroma — the color intensity for this HSL value
- X= Intermediate value determining which RGB sector applies
- m= Match offset that shifts all channels to the correct lightness
The Six Palette Harmony Types Explained
Each harmony type positions colors at specific angular relationships on the 360° HSL hue wheel. The tool generates five colors for the fixed-count palettes (Complementary, Triadic, Tetradic, Split Complementary) and between 3 and 10 colors for the variable-count palettes (Analogous and Monochromatic).
| Type | Hue Offsets | Best Use |
|---|---|---|
| Complementary | 0°, 180° (+ lightness variants) | High contrast, call-to-action buttons |
| Analogous | ±30° steps centered on base hue | Natural, cohesive, low-tension designs |
| Triadic | 0°, 120°, 240° | Vibrant, balanced, three-accent brands |
| Tetradic (Square) | 0°, 90°, 180°, 270° | Rich palettes; needs careful balancing |
| Split Complementary | 0°, 150°, 210° | High contrast with less tension than full complementary |
| Monochromatic | Fixed hue; lightness varies 20%–80% | Elegant, polished, single-brand tones |
Complementary palettes also add a darker variant (L − 15) and a lighter variant (L + 15) of both the base and complementary hue to give you five usable swatches. The Triadic type reduces saturation by 20 percentage points on its muted swatch, giving a softer accent alongside the vivid triadic pair.
Analogous Color Step Formula
The Analogous palette type is the most mathematically transparent of all six options. Given a base hue H and a requested count of n colors, the tool spaces the swatches evenly around H in 30° increments, with H always at the center of the range. The formula for the hue of each color at position i (starting at 0) is shown below.
For example, choosing 5 analogous colors centered on red (H = 0°) produces hues at −60°, −30°, 0°, 30°, and 60°. Because the HSL engine normalizes any negative angle — ((H % 360) + 360) % 360 — the −60° becomes 300° (magenta-violet) and −30° becomes 330° (rose). The result is a smooth band of related hues that appear adjacent on the color wheel, which is exactly why analogous palettes feel calm and cohesive. The 30° step is fixed in the code; adjusting the number of colors widens or narrows the total arc (n × 30°) rather than changing the step size.
Because saturation and lightness are held constant across all analogous swatches, the palette maintains uniform brightness, making it easy to swap colors for different UI states without altering the visual weight of a design element.
Analogous Hue at Position i
Where:
- H= Base hue in degrees (0–360)
- n= Total number of colors requested (3–10)
- i= Index of the current color swatch (0-based)
- angle_i= Hue angle for the i-th swatch; wrapped to 0–360° before conversion
Monochromatic Shade Progression
The Monochromatic palette keeps hue and saturation identical across every swatch and varies only the Lightness channel. The generator distributes lightness values evenly from 20% (near-black) to 80% (near-white), which avoids the harsh extremes of pure black and pure white while still providing a wide tonal range. The formula is a simple linear interpolation across the available lightness band.
For a 5-color monochromatic palette the lightness values are 20%, 35%, 50%, 65%, and 80%. A 3-color palette yields 20%, 50%, and 80%. A 10-color palette produces increments of about 6.67 percentage points. The step size automatically adjusts so the first swatch is always the darkest (20%) and the last is always the lightest (80%), regardless of how many swatches you choose.
Monochromatic schemes are extremely versatile in interface design. The darkest shades work well for text and borders; mid-tones serve as background fills and card surfaces; the lightest shades pair well with subtle hover states or disabled controls. Because every color shares the same hue, the palette stays cohesive and on-brand even when elements vary dramatically in visual weight.
Monochromatic Lightness at Index i
Where:
- L_i= Lightness percentage for the i-th swatch
- i= Zero-based index of the swatch (0 = darkest, n−1 = lightest)
- n= Total number of colors (3–10)
- 60= Total lightness range: 80% − 20% = 60 percentage points
Applying Color Palettes in Real Design Projects
Generating a palette is only the first step; applying it well in a real project requires a few guiding principles from color theory and interface design. A common rule of thumb is the 60-30-10 rule: 60% of a design's color area goes to a dominant neutral or background color, 30% to a secondary color that provides structure, and 10% to an accent color that draws attention to key actions like buttons or alerts. Using the CSS custom properties exported by this tool makes it trivial to implement this split in a stylesheet.
When using a Complementary palette, reserve the complementary hue for high-contrast highlights rather than large blocks of color. Full-saturation complementary pairs like blue and orange can be overwhelming at equal visual weight; reducing saturation or lightness on one of them restores balance. The tool already provides darker and lighter variants of both the base and complementary hue to give you this flexibility immediately.
For dashboards and data-rich interfaces, Triadic and Tetradic palettes offer enough distinct hues to color-code multiple data series without any two series looking ambiguous. The Triadic muted swatch (base hue at S − 20%) is particularly useful as a background fill that keeps the chart area visually quiet while the two vivid triadic hues pop as data colors.
Accessibility is a critical consideration with any palette. WCAG 2.1 requires a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text against the background. Monochromatic palettes generated from mid-saturation bases often struggle here — use the darkest shade (L ≈ 20%) for text on white backgrounds, or the lightest shade (L ≈ 80%) for text on dark-mode surfaces. Always verify contrast ratios with a dedicated color contrast tool before shipping.
The CSS Variables output from this generator is designed to slot directly into a design token system. Drop the :root { } block into a global stylesheet and reference var(--color-1) through var(--color-5) throughout your component library. Changing the base color later requires updating only the generator — all downstream tokens update automatically.
Worked Examples
Analogous Palette from Red (#FF0000) with 5 Colors
Problem:
Given the base color #FF0000 (pure red) and the Analogous palette type with 5 colors, what are the five hue angles and approximate hex values?
Solution Steps:
- 1Convert #FF0000 to HSL: R=1, G=0, B=0 → max=1 (R), min=0 → L=(1+0)/2=0.50 (50%), d=1, S=1/(1+0)=1.00 (100%), H=((0−0)/1+0)/6=0 → 0°. Base HSL: H=0°, S=100%, L=50%.
- 2Apply the analogous formula with n=5, ⌊5/2⌋=2: angle_i = 0 + (i−2)×30°. For i=0: −60°→300°; i=1: −30°→330°; i=2: 0°; i=3: 30°; i=4: 60°.
- 3Convert each angle at S=100%, L=50% back to hex: 300° → #FF00FF (magenta), 330° → #FF0080 (rose), 0° → #FF0000 (red), 30° → #FF8000 (orange), 60° → var(--card-bg)F00 (yellow).
Result:
5-color analogous palette: #FF00FF, #FF0080, #FF0000, #FF8000, var(--card-bg)F00 — a smooth warm-to-cool band centered on red.
Triadic Palette from Green (#00FF00)
Problem:
Given the base color #00FF00 (pure green), what are the five colors in the Triadic palette?
Solution Steps:
- 1Convert #00FF00 to HSL: R=0, G=1, B=0 → max=1 (G), min=0 → L=50%, d=1, S=100%, max=G so H=((0−0)/1+2)/6=2/6 → 120°. Base HSL: H=120°, S=100%, L=50%.
- 2Compute the five Triadic swatches per the code: Base=#00FF00 (H=120°), Triadic 1=hslToHex(240°,100%,50%)=var(--foreground)0FF (blue), Triadic 2=hslToHex(360°,100%,50%)=hslToHex(0°,100%,50%)=#FF0000 (red), Muted=hslToHex(120°,80%,50%), Light=hslToHex(120°,100%,70%).
- 3Compute Muted: S=0.8, L=0.5 → C=0.8, X=0 (H/60=2, 2%2=0, |0−1|=1, X=0.8×0=0), m=0.1. H=120° sector: r=0, g=C=0.8, b=0 → R=26, G=230, B=26 → #1AE61A. Compute Light: S=1, L=0.7 → C=0.6, X=0, m=0.4. r=0, g=0.6, b=0 → R=102, G=255, B=102 → #66FF66.
Result:
Triadic palette: #00FF00 (base), var(--foreground)0FF (blue), #FF0000 (red), #1AE61A (muted green), #66FF66 (light green).
Monochromatic Palette from Blue (var(--foreground)0FF) with 5 Colors
Problem:
Given the base color var(--foreground)0FF (pure blue) and Monochromatic type with 5 colors, what lightness values and hex codes does the generator produce?
Solution Steps:
- 1Convert var(--foreground)0FF to HSL: R=0, G=0, B=1 → max=1 (B), min=0 → L=50%, S=100%, max=B so H=((0−0)/1+4)/6=4/6 → 240°. Base HSL: H=240°, S=100%, L=50%.
- 2Apply monochromatic formula with n=5: L_i = 20 + i×60/(5−1) = 20 + i×15. Values: i=0→20%, i=1→35%, i=2→50%, i=3→65%, i=4→80%.
- 3Convert each to hex at H=240°, S=100%: L=20%→var(--foreground)066 (navy), L=35%→var(--foreground)0B3 (dark blue), L=50%→var(--foreground)0FF (blue), L=65%→#4D4DFF (periwinkle), L=80%→#9999FF (lavender).
Result:
5-shade monochromatic blue palette: var(--foreground)066, var(--foreground)0B3, var(--foreground)0FF, #4D4DFF, #9999FF — from near-black navy to soft lavender.
Complementary Palette from Orange (#FF8000)
Problem:
For a brand using the base color #FF8000 (orange), what does the Complementary palette produce?
Solution Steps:
- 1Convert #FF8000: R=1, G=0.502, B=0. max=1(R), min=0(B) → L=(1+0)/2=50%, d=1, S=100% (L=0.5, not >0.5, so S=1/(1+0)=1). max=R: H=((0.502−0)/1+0)/6=0.502/6≈0.0836 → 30.1°≈30°.
- 2Build the 5 Complementary swatches: Base=#FF8000 (H=30°,S=100%,L=50%), Complementary=hslToHex(210°,100%,50%), Darker=hslToHex(30°,100%,35%), Lighter=hslToHex(30°,100%,65%), Comp.Darker=hslToHex(210°,100%,35%).
- 3hslToHex(210°,100%,50%): C=1, X=1×(1−|210/60%2−1|)=1×(1−|3.5%2−1|)=1×(1−|1.5−1|)=1×0.5=0.5, m=0. H=210°: sector 180–240 → r=0, g=X=0.5, b=C=1 → R=0, G=128, B=255 → #0080FF (azure blue). Comp.Darker at L=35%: C=0.7, X=0.35, m=0 → #004DB3.
Result:
Complementary palette: #FF8000 (orange), #0080FF (azure), #B35900 (dark orange), #FF9933 (light orange), #004DB3 (dark azure) — a vivid warm/cool contrast scheme.
Tips & Best Practices
- ✓Use Complementary palettes for high-contrast hero sections and call-to-action buttons — the 180° hue shift creates the strongest possible visual pop.
- ✓Analogous palettes look most natural when the base hue falls in a warm range (reds, oranges, yellows) or a cool range (blues, greens, purples) — avoid bridging both zones.
- ✓For dark-mode interfaces, generate a Monochromatic palette and use the L=20% swatch as the page background, mid-tones for cards, and the L=65–80% shades for text.
- ✓The CSS Variables output uses --color-1 through --color-N, making it trivial to integrate with any existing CSS custom property workflow or design token pipeline.
- ✓When using a Tetradic palette, allow one hue to dominate (60% of area), use two as secondary accents (30%), and reserve the fourth for micro-interactions or data highlights.
- ✓Click 'Random Base Color' a few times to break out of color ruts — unexpected base hues often produce palette combinations that feel fresher than your usual go-to choices.
- ✓Check accessibility contrast after generating: the L=20% monochromatic shade typically provides 4.5:1 contrast against white, while L=80% shades often require a dark background to meet WCAG AA.
- ✓Split Complementary is a safer starting point than full Complementary for first-time color scheme design — it offers nearly the same visual energy with far less risk of clashing.
Frequently Asked Questions
Sources & References
Last updated: 2026-06-05
Help us improve!
How would you rate the Color Palette Generator?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Standard Mathematical References
by Various