Drop an image,
paste a :root{}
upload account paywall
Drop any image and get a 3–12 color palette with CSS custom properties, Tailwind v3/v4 configs, JSON design tokens, and a WCAG 2.1 contrast-pairings matrix. No upload. No account. No paywall.
Drop an image. Get the palette.
CANVAS API · ZERO UPLOADDrop your image here
or browse · JPEG · PNG · WebP · GIF
:root {
--color-1: #E8FF3C;
--color-2: #2F1F9A;
--color-3: #FF5A36;
--color-4: #41D6FF;
--color-5: #C39DFF;
--color-6: #D5C8A8;
}Every pair, graded.
WCAG 2.1 · AA / AAA#E8FF3C / #2F1F9A
#2F1F9A / #D5C8A8
#2F1F9A / #41D6FF
#2F1F9A / #C39DFF
Color format syntax and export reference
Hexroot extracts color palettes from images and emits them in formats you paste into code. The reference below catalogs the color notations, Tailwind config variants, and design-token JSON shapes those exports build on. Use it when you need the exact syntax for a specific format, or when picking which export tab to copy.
CSS color formats at a glance
| Format | Syntax shape | Alpha | Color gamut | Browser support |
|---|---|---|---|---|
| #RGB | 3-digit hex | No | sRGB | Universal |
| #RGBA | 4-digit hex | Yes | sRGB | Modern (2018+) |
| #RRGGBB | 6-digit hex | No | sRGB | Universal |
| #RRGGBBAA | 8-digit hex | Yes | sRGB | Modern (2018+) |
| rgb() / rgba() | functional, comma or space | Yes | sRGB | Universal |
| hsl() / hsla() | hue-sat-lightness | Yes | sRGB | Universal |
| hwb() | hue-white-black | Yes | sRGB | Modern (2022+) |
| lab() | L-A-B perceptual | Yes | Wide gamut | Modern (2023+) |
| lch() | L-chroma-hue perceptual | Yes | Wide gamut | Modern (2023+) |
| oklab() | improved Lab | Yes | Wide gamut | Modern (2023+) |
| oklch() | improved LCH | Yes | Wide gamut | Modern (2023+) |
| color() | named color space | Yes | Configurable | Modern (2023+) |
| color-mix() | function mixer | Yes | Configurable | Modern (2023+) |
| currentColor | inherited from parent | Inherited | Inherited | Universal |
| named (tomato, coral) | CSS Color Module L4 keyword | No | sRGB | Universal |
Hex notation forms
Hexroot’s CSS Variables export uses 6-digit uppercase hex (#RRGGBB). The full hex family:
| Form | Pattern | Equivalent expansion | Example |
|---|---|---|---|
| Short | #RGB | each digit doubles | #f3c = #ff33cc |
| Short with alpha | #RGBA | each digit doubles, alpha last | #f3c8 = #ff33cc88 |
| Long | #RRGGBB | full byte per channel | #ff33cc |
| Long with alpha | #RRGGBBAA | adds alpha byte | #ff33cc88 |
Notes on hex:
- Short-form digits double rather than concatenate.
#abcis#aabbcc, not#0a0b0c. - Hex is case-insensitive; Hexroot exports uppercase for diff readability in code review.
- 8-digit alpha hex is in every modern engine, but older Sass releases (pre-1.10) and pre-3.3 Tailwind strip the alpha byte during parsing.
RGB syntax
CSS Color Module Level 4 accepts two valid syntaxes that coexist in the modern parser:
CSS/* Legacy comma syntax */ color: rgb(255, 51, 204); color: rgba(255, 51, 204, 0.5); /* Modern space-separated with slash for alpha */ color: rgb(255 51 204); color: rgb(255 51 204 / 0.5); /* Modern percentage forms */ color: rgb(100% 20% 80%); color: rgb(100% 20% 80% / 50%); /* Modern number/percent mixing is disallowed */ color: rgb(255 20% 204); /* parse error */
rgb() and rgba() are aliases in the modern parser, and both accept either alpha style. Pick one within a codebase.
HSL syntax
CSS/* Legacy comma syntax */ color: hsl(316, 100%, 60%); color: hsla(316, 100%, 60%, 0.5); /* Modern space-separated */ color: hsl(316 100% 60%); color: hsl(316 100% 60% / 0.5); /* Hue units (CSS Color L4) */ color: hsl(316deg 100% 60%); color: hsl(0.878turn 100% 60%); color: hsl(5.514rad 100% 60%);
Saturation and lightness must be percentages. Hue accepts deg, turn, rad, grad, or unitless (interpreted as deg). HSL is sRGB; for perceptually uniform lightness use OKLCH instead.
OKLCH and wide-gamut formats
OKLCH is the recommended modern format for design-system tokens. Perceptually uniform lightness means a 50% L value reads as the same brightness across hues, which makes generating tint/shade scales mathematically clean.
CSS/* OKLCH: L 0-1 or 0-100%, C 0-0.4+, H 0-360 */ color: oklch(0.7 0.18 316); color: oklch(70% 0.18 316deg / 50%); /* OKLAB: L 0-1 or 0-100%, a/b roughly -0.4 to 0.4 */ color: oklab(0.7 0.16 -0.09); /* LAB / LCH: D50 reference, broader ranges */ color: lab(60 70 -40); color: lch(60 80 316); /* Display-P3 wide-gamut explicit */ color: color(display-p3 1 0.2 0.8); /* color-mix interpolates in any color space */ color: color-mix(in oklch, #6ba8e8 60%, #e8c56b);
Generating tints in HSL: stepping L from 60 to 70 around yellow looks darker than the same step around blue. Generating tints in OKLCH: the steps are visually equal across hue.
Tailwind v3 color config
Hexroot’s Tailwind v3 export targets tailwind.config.js. The full shape it supports:
// tailwind.config.js (v3)
module.exports = {
theme: {
extend: {
colors: {
// Flat single-value token
'palette-1': '#6BA8E8',
// Nested scale (palette-50 through palette-900)
brand: {
50: '#f0f6fc',
100: '#dbe9f5',
500: '#3D6FA3',
900: '#0e2a44',
DEFAULT: '#3D6FA3', // accessible as `bg-brand`
},
// CSS variable reference (runtime theming)
accent: 'rgb(var(--accent-rgb) / <alpha-value>)',
},
},
},
};The <alpha-value> placeholder lets bg-accent/50 interpolate alpha at runtime. It requires the CSS variable to hold the bare space-separated RGB triple (--accent-rgb: 255 51 204), not the full rgb() call.
Tailwind v4 @theme syntax
Tailwind v4 collapses the JS config into CSS. The @theme block declares custom properties that compile into utility classes:
@import "tailwindcss";
@theme {
/* Single token */
--color-palette-1: #6BA8E8;
/* Scale: --color-{name}-{step} generates bg-name-step utilities */
--color-brand-50: #f0f6fc;
--color-brand-500: #3D6FA3;
--color-brand-900: #0e2a44;
/* OKLCH source token (recommended for v4) */
--color-accent: oklch(0.65 0.22 28);
/* Non-color tokens use other prefixes */
--font-display: "Fraunces", serif;
--radius-card: 4px;
}What changed from v3:
- No JS config required; tokens live in CSS.
- All color tokens use
--color-prefix. The suffix becomes the utility name, so--color-palette-1producesbg-palette-1,text-palette-1,border-palette-1. - The
<alpha-value>placeholder is gone. Alpha goes throughcolor-mix()automatically when a utility includes/N. - Custom properties cascade into media queries, so dark-mode overrides work natively without a
dark:prefix on every utility.
Design-token JSON formats
Hexroot’s JSON export emits a flat enriched shape. The wider design-token ecosystem has three competing shapes worth knowing before choosing where to paste a palette.
Hexroot enriched flat shape (Style Dictionary compatible with a transform):
JSON{
"color-1": {
"hex": "#6BA8E8",
"rgb": { "r": 107, "g": 168, "b": 232 },
"hsl": { "h": 211, "s": 73, "l": 66 }
}
}W3C Design Tokens Community Group (DTCG, draft):
JSON{
"color": {
"primary": {
"$type": "color",
"$value": "#6BA8E8"
}
}
}Tokens Studio (Figma plugin):
JSON{
"global": {
"color": {
"primary": {
"value": "#6BA8E8",
"type": "color"
}
}
}
}Style Dictionary v3:
JSON{
"color": {
"primary": {
"value": "#6BA8E8",
"comment": "Brand primary"
}
}
}Pick a shape early. Tooling assumes one, and converters between shapes are lossy: DTCG’s $value can hold a reference like {color.primary} that Style Dictionary v3’s value resolves at build time, while Tokens Studio’s nested value/type keys disagree with DTCG’s $value/$type keys on every level.
Common-failure patterns
| Symptom | Cause | Fix |
|---|---|---|
| bg-accent/50 produces solid color, not 50% opacity | CSS variable holds full rgb(...) call instead of bare triple | Store as --accent-rgb: 255 51 204, reference as rgb(var(--accent-rgb) / <alpha-value>) |
| 8-digit hex #ff33cc88 renders opaque in compiled CSS | Sass < 1.10 strips alpha byte during parsing | Upgrade Sass or pre-convert to rgba() before the value enters Sass |
| OKLCH colors render flat or wrong in older Safari | Engine fallback to sRGB clipping below 16.4 | Pair with a color(display-p3 ...) declaration so modern browsers pick the wide-gamut value |
| color-mix() returns transparent black | One operand is unparseable (typo, missing percent unit) | Validate both colors compile standalone before passing them to color-mix |
| Tailwind v4 bg-palette-1 class doesn't exist | Token named --palette-1 instead of --color-palette-1 | All Tailwind v4 color tokens require the --color- prefix; the suffix becomes the utility |
| Design-token JSON imports as [object Object] in Figma | Tokens Studio expects flat value field, not nested hex/rgb/hsl | Use the Tokens Studio or W3C shape when importing to Figma; keep Hexroot's enriched shape for build pipelines |
| WCAG ratio reports 1.00 for two distinct colors | Both hex values are mistyped to the same string (case mismatch) | Recompute with uppercase normalized hex; both Hexroot and the WCAG formula are case-insensitive but copy errors aren't |
Related concepts
- sRGB vs Display-P3 gamut.
oklch()andcolor()notations open up the wider P3 gamut available on modern hardware; sRGB-only formats clip values outside the cube. - Relative luminance. The WCAG 2.1 contrast formula weights G channel highest (0.7152), then R (0.2126), then B (0.0722); luminance is the input to the pairwise contrast ratio.
- CIE Lab color space. Perceptually uniform reference space designed in 1976; OKLab is a 2020 refinement that better predicts blue-region perception and is the basis for OKLCH.
- Tokens Studio plugin. Figma plugin for design-token management; uses its own JSON shape and supports
valuereferences via{group.subgroup.name}notation at build time. - Design Tokens Community Group (DTCG). W3C draft standardizing token shape; uses
$value,$type,$descriptionprefixed keys for forward compatibility with future versions.