Color Palette Generator

Generate harmonious color palettes based on color theory for web design, UI/UX, and creative projects.

Palette Settings

Generated Palette

Base

#3B82F6

Complementary

#F6AF3B

Darker

#0A59DA

Lighter

#84B1F9

Comp. Darker

#DA8B0A

Palette 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

C = (1 − |2L − 1|) × S X = C × (1 − |(H / 60) mod 2 − 1|) m = L − C / 2 R, G, B = (channel + m) × 255

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

angle_i = H + (i − ⌊n / 2⌋) × 30° for i = 0, 1, …, n − 1

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

L_i = 20 + i × 60 / (n − 1) for i = 0, 1, …, n − 1

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:

  1. 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%.
  2. 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°.
  3. 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:

  1. 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%.
  2. 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%).
  3. 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:

  1. 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%.
  2. 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%.
  3. 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:

  1. 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°.
  2. 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%).
  3. 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

A complementary palette pairs your base color with the hue exactly 180° opposite on the color wheel, producing the maximum possible contrast. A split-complementary palette instead uses the two hues flanking that opposite point — at 150° and 210° from the base — which retains high contrast but with a softer, less jarring tension. Split complementary is often easier to work with in UI design because the two accent hues give more variety without clashing as aggressively as a direct complementary pair.
RGB and HEX define colors as mixtures of red, green, and blue light, which makes it very difficult to express intuitive color relationships like 'rotate 120° on the color wheel.' HSL separates the perceptual attributes — what color it is (hue), how vivid it is (saturation), and how bright it is (lightness) — into independent axes. That separation makes shifting hue by a fixed angle straightforward arithmetic, which is exactly what all color harmony rules require. The tool converts in and out of HEX only at the input and output boundaries.
Both the Analogous and Monochromatic palette types accept between 3 and 10 colors via the 'Number of Colors' input, which appears automatically when either of those types is selected. The other four types (Complementary, Triadic, Tetradic, Split Complementary) always produce exactly 5 swatches, because their harmony rules define a fixed number of distinct hue positions. Changing the color count on Analogous widens the arc of hues covered (each step is always 30°), while on Monochromatic it adjusts the spacing between lightness shades across the fixed 20%–80% range.
Yes. Each color swatch shows its hex code, which you can copy with the individual Copy button or copy the entire list at once with 'Copy All.' Hex codes are universally supported in Figma, Sketch, Adobe XD, Illustrator, and virtually every other design application. The CSS Variables block at the bottom of the results panel is ready to paste directly into a design token file or a global stylesheet if you are working in code.
The Triadic and Split Complementary palettes include a muted swatch that reduces the base hue's saturation by 20 percentage points. Fully saturated colors can feel overwhelming when used at large scale, so the muted variant gives you a toned-down version of the base that works well as a background fill, secondary button style, or hover state. Having both the vivid and muted versions of the base in the same palette makes it easier to use one harmonic family consistently without everything competing for attention.
The Random Base Color button generates a random hex value by picking a number between 0 and 16,777,215 (the total number of 24-bit colors) and converting it to a 6-character hex string. This is a quick way to explore unexpected combinations — you might discover a palette you would never have chosen consciously. Clicking it repeatedly lets you browse a wide range of color families until one resonates with your project's mood or brand direction.
The hex values are as mathematically precise as IEEE 754 double-precision floating point and integer rounding allow. Each channel is multiplied by 255 and rounded to the nearest integer before being formatted as a two-digit hex pair. In practice this means the output can differ by at most 1 unit per channel from the theoretical ideal — a difference that is visually imperceptible (less than 0.4% brightness deviation). The round-trip from HEX → HSL → HEX on the original base color will reproduce the original exactly.

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.

Source

Formula Source: Standard Mathematical References

by Various

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.