Color Palette Generator
Pick a base color and get five that go with it. Lock the ones you like, check their contrast, and copy the CSS.
https://flxcode.com/color-palette-generator/
- Base#1d5fc2 oklch(50.3% 0.169 259) Against white: 6.05:1AA pass, AAA fail Against black: 3.46:1AA fail, large text pass, AAA fail
- Base#7194cc oklch(66.3% 0.093 260) Against white: 3.08:1AA fail, large text pass, AAA fail Against black: 6.81:1AA pass, AAA fail
- Base#845c00 oklch(50.4% 0.105 79) Against white: 5.97:1AA pass, AAA fail Against black: 3.51:1AA fail, large text pass, AAA fail
- Base#b28c4e oklch(66.3% 0.092 78) Against white: 3.10:1AA fail, large text pass, AAA fail Against black: 6.75:1AA pass, AAA fail
- Base#04265a oklch(28.2% 0.101 259) Against white: 14.68:1AA pass, AAA pass Against black: 1.43:1AA fail, AAA fail
AA needs 4.5:1 for normal text and 3:1 for large text (18 pt, or 14 pt bold). AAA needs 7:1 and 4.5:1. Ratios are cut down, never rounded up.
With focus in the tool, press the space bar to regenerate. Locked colors stay put.
:root {
--palette-1: #1d5fc2;
--palette-2: #7194cc;
--palette-3: #845c00;
--palette-4: #b28c4e;
--palette-5: #04265a;
} Colors are worked out in OKLCH and rounded to sRGB hex. A color that sRGB cannot show loses chroma, not lightness or hue. Nothing is uploaded.
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.
Problem or idea? Email us
Quick start
- Pick a base color, or type its hex code. Random base gives you one to start from.
- Choose a scheme. The five colors change at once.
- Press the space bar or Regenerate for a variation. Lock a color to keep it.
- Read the contrast under each color, then copy the CSS variables, the hex list or the PNG strip.
Numbers this uses
- OKLab matrices and the cube-root step: Björn Ottosson, "A perceptual color space for image processing" (2020). Chroma is the length of the a and b parts, hue is their angle.
- Contrast ratio: (L1 + 0.05) ÷ (L2 + 0.05), with L the relative luminance 0.2126 R + 0.7152 G + 0.0722 B on linear values (WCAG 2.2).
- Thresholds: 4.5 for AA normal text, 3 for AA large text, 7 for AAA normal text, 4.5 for AAA large text (WCAG 2.2, success criteria 1.4.3 and 1.4.6).
- Hue shifts: complementary 180, triadic 120 and 240, tetradic 60, 180 and 240, analogous ±15 and ±30. These are the textbook angles.
- Lightness and chroma steps in each scheme, the lightness limits 0.12 to 0.97 and the Regenerate jitter (14 degrees, 0.05, 15 percent): our choices, tuned by eye.
- Colors are rounded to 8 bits per channel in sRGB. A color outside sRGB loses chroma until it fits.
Worked examples
Three base colors in all five schemes, made by the same code as the tool with no random variation. The base is the first listed color it appears in.
Blue base #1D5FC2
| Scheme | Five colors |
|---|---|
| Complementary | #1d5fc2#7194cc#845c00#b28c4e#04265a |
| Analogous | #007aa1#006fae#1d5fc2#454fbb#5a40af |
| Triadic | #1d5fc2#b02b3c#287800#80a1d4#0f3900 |
| Tetradic | #1d5fc2#8b3ba0#845c00#287800#80a1d4 |
| Monochrome | #00143a#003681#1d5fc2#548feb#98c0ff |
Red-orange base #E04A2F
| Scheme | Five colors |
|---|---|
| Complementary | #e04a2f#f19d8b#0095ab#58c8dd#78281a |
| Analogous | #e95287#e74b5f#e04a2f#c95800#af6400 |
| Triadic | #e04a2f#009f52#6176f5#faac9c#354293 |
| Tetradic | #e04a2f#a08200#0095ab#6176f5#faac9c |
| Monochrome | #600c00#a51d00#e04a2f#ff8f78#ffd9d1 |
Green base #2F8F5B
| Scheme | Five colors |
|---|---|
| Complementary | #2f8f5b#8ab899#a65d96#c69cbb#16482d |
| Analogous | #75933b#56924b#2f8f5b#00896b#008077 |
| Triadic | #2f8f5b#6773c1#b65e46#99c4a7#683021 |
| Tetradic | #2f8f5b#0089a1#a65d96#b65e46#99c4a7 |
| Monochrome | #00331a#006036#2f8f5b#6bbc8b#b2e6c4 |
Contrast, step by step
Take #1D5FC2, which is R 29, G 95, B 194. After linearizing each channel, its relative luminance is 0.1234.
against white: (1 + 0.05) ÷ (0.1234 + 0.05) = 6.05:1, AA pass, AAA fail
against black: (0.1234 + 0.05) ÷ (0 + 0.05) = 3.46:1, AA fail, large text pass, AAA fail
Known pairs, as a check on any contrast tool:
| Color on white | Ratio | Result |
|---|---|---|
| #767676 | 4.54:1 | AA pass, AAA fail |
| #777777 | 4.47:1 | AA fail, large text pass, AAA fail |
| #595959 | 7.00:1 | AA pass, AAA pass |
| #ffffff | 1.00:1 | AA fail, AAA fail |
| #000000 | 21.00:1 | AA pass, AAA pass |
| #ff0000 | 3.99:1 | AA fail, large text pass, AAA fail |
| #0000ff | 8.59:1 | AA pass, AAA pass |
#767676 is the lightest grey that passes AA on white. Ratios are cut down to two decimals, never rounded up, so 4.499 does not show as 4.50 next to a fail.
The five schemes
| Scheme | Hue shifts (degrees) | Use it for |
|---|---|---|
| Complementary | 0, 0, +180, +180, 0 | High contrast, one accent against a main color. |
| Analogous | -30, -15, 0, +15, +30 | Calm, related colors for backgrounds and gradients. |
| Triadic | 0, +120, +240, 0, +240 | Lively sets where three colors share the work. |
| Tetradic | 0, +60, +180, +240, 0 | Rich sets with two warm and two cool colors. |
| Monochrome | 0, 0, 0, 0, 0 | One hue in dark to light steps, safe for charts and UI. |
Why the palette looks even
HSL says #FFD400 and #1D5FC2 have lightness 50% and 44%, close to each other, yet one is bright yellow and the other a dark blue. OKLCH puts them at oklch(88.1% 0.181 94) and oklch(50.3% 0.169 259). A step in lightness there is a step you can see, so a scheme keeps its balance when the hue turns.
Limits
- Five colors. No saving of palettes, no sharing link and no import from a picture. For that, use Color Picker from Image.
- Contrast is checked against pure white and pure black only. Text on another background needs its own check.
- Contrast ratios do not cover color blindness. Do not use color alone to carry meaning.
- Screens differ. The hex codes are exact, the way they look is not.
Nothing you pick is uploaded. We count events without cookies, such as the scheme used, never a color (details).
FAQ
How do I make a color palette from one color?
Type or pick the base color, then choose a scheme. The page turns the base into OKLCH (lightness, chroma, hue), keeps the base exactly as you gave it, and builds the other four colors by shifting the hue and lightness by fixed amounts. Press Regenerate for a nearby variation.
What is the difference between the five schemes?
Complementary pairs the base with the color 180 degrees around the hue wheel. Analogous uses neighbors at -30, -15, +15 and +30 degrees. Triadic spaces colors 120 degrees apart. Tetradic uses 0, 60, 180 and 240 degrees, two complementary pairs. Monochrome keeps the hue and steps the lightness from dark to light.
Why OKLCH and not HSL?
In OKLCH, lightness matches what the eye sees. In HSL, pure blue and yellow both have a lightness of 50%, yet yellow looks far brighter. The blue #1D5FC2 is L 50% in OKLCH and the yellow #FFD400 is 88%. Equal steps in OKLCH look equal, so a palette built there has an even feel.
What do AA and AAA mean?
They are levels of WCAG, the web accessibility guidelines. AA asks for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18 pt, or 14 pt bold). AAA asks for 7:1 and 4.5:1. The page shows the ratio of each color against white and against black, so you can see which text color works on it.
How do Lock and Regenerate work?
Lock a color and it stays when you press Regenerate, change the scheme or change the base. Regenerate shifts each unlocked color by a small random amount: up to 14 degrees of hue, 0.05 of lightness and 15 percent of chroma. The base color itself never moves. On a computer you can press the space bar, on a phone use the button.
How do I use the palette in CSS?
Choose Copy CSS variables and paste the :root block into your stylesheet. You get --palette-1 to --palette-5 as hex, to use as var(--palette-1). Copy hex list gives one color per line for a design tool, and the PNG strip is a 1000 by 240 picture with the codes written on it.
Why is a color less colorful than the formula says?
Some OKLCH colors cannot be shown on an sRGB screen. A color with L 70%, chroma 0.4 and hue 150 is one of them. The page keeps its lightness and hue and lowers the chroma until it fits: here it ends at chroma 0.19. Very bright or very dark bases lose the most.
Is my color sent anywhere?
No. The colors are worked out in your browser. They are not put in the address bar, stored or counted. We only count events such as which scheme was used.
More from FLXCode
Color Picker from ImageNew
Click a picture to get the HEX, RGB and HSL of any pixel, plus its dominant colors. Nothing is uploaded.
Blur ImageNew
Blur a whole photo or drawn rectangles, with a strength you set. Nothing is uploaded, and EXIF data is left out.
Pixelate ImageNew
Pixelate faces, plates or text in rectangles you draw, or the whole picture. Nothing is uploaded.
Remove Background from ImageNew
Cut the background out of product, object and pet photos in your browser. Nothing is uploaded.