OKLCH Studio · shadcn/ui accent theme

shadcn/ui Red theme colors: primary oklch(0.505 0.213 27.518) & chart tokens

shadcn/ui Red: primary #c10007 light / #9f0712 dark (oklch(0.505 0.213 27.518)). 19 of 22 checked pairs meet WCAG AA 4.5:1 (light 9/11, dark 10/11). Copy the accent overrides on the neutral base as OKLCH, @theme mapping or hex.

Red is an accent theme: it overrides primary, secondary, the chart colours and sidebar-primary, and sits on top of a base colour. Every other value below comes from the neutral base (shadcn's default), and the contrast audit uses that combination. Source: shadcn/ui (MIT, © 2023 shadcn); all themes.

Preview

Card title

Muted description text on the card.

PrimarySecondaryAccentDestructive

Muted block with input border

light

Card title

Muted description text on the card.

PrimarySecondaryAccentDestructive

Muted block with input border

dark

light mode tokens

Red light mode colour tokens with oklch, hex and sRGB gamut
TokenSwatchoklch()HexIn sRGB
--backgroundoklch(1 0 0)#ffffffYes
--foregroundoklch(0.145 0 0)#0a0a0aYes
--cardoklch(1 0 0)#ffffffYes
--card-foregroundoklch(0.145 0 0)#0a0a0aYes
--popoveroklch(1 0 0)#ffffffYes
--popover-foregroundoklch(0.145 0 0)#0a0a0aYes
--primaryredoklch(0.505 0.213 27.518)#c10007No — hex is clipped
--primary-foregroundredoklch(0.971 0.013 17.38)#fef2f2Yes
--secondaryredoklch(0.967 0.001 286.375)#f4f4f5Yes
--secondary-foregroundredoklch(0.21 0.006 285.885)#18181bYes
--mutedoklch(0.97 0 0)#f5f5f5Yes
--muted-foregroundoklch(0.556 0 0)#737373Yes
--accentoklch(0.97 0 0)#f5f5f5Yes
--accent-foregroundoklch(0.205 0 0)#171717Yes
--destructiveoklch(0.577 0.245 27.325)#e7000bNo — hex is clipped
--borderoklch(0.922 0 0)#e5e5e5Yes
--inputoklch(0.922 0 0)#e5e5e5Yes
--ringoklch(0.708 0 0)#a1a1a1Yes
--chart-1redoklch(0.808 0.114 19.571)#ffa2a2No — hex is clipped
--chart-2redoklch(0.637 0.237 25.331)#fb2c36Yes
--chart-3redoklch(0.577 0.245 27.325)#e7000bNo — hex is clipped
--chart-4redoklch(0.505 0.213 27.518)#c10007No — hex is clipped
--chart-5redoklch(0.444 0.177 26.899)#9f0712Yes
--sidebaroklch(0.985 0 0)#fafafaYes
--sidebar-foregroundoklch(0.145 0 0)#0a0a0aYes
--sidebar-primaryredoklch(0.577 0.245 27.325)#e7000bNo — hex is clipped
--sidebar-primary-foregroundredoklch(0.971 0.013 17.38)#fef2f2Yes
--sidebar-accentoklch(0.97 0 0)#f5f5f5Yes
--sidebar-accent-foregroundoklch(0.205 0 0)#171717Yes
--sidebar-borderoklch(0.922 0 0)#e5e5e5Yes
--sidebar-ringoklch(0.708 0 0)#a1a1a1Yes

dark mode tokens

Red dark mode colour tokens with oklch, hex and sRGB gamut
TokenSwatchoklch()HexIn sRGB
--backgroundoklch(0.145 0 0)#0a0a0aYes
--foregroundoklch(0.985 0 0)#fafafaYes
--cardoklch(0.205 0 0)#171717Yes
--card-foregroundoklch(0.985 0 0)#fafafaYes
--popoveroklch(0.205 0 0)#171717Yes
--popover-foregroundoklch(0.985 0 0)#fafafaYes
--primaryredoklch(0.444 0.177 26.899)#9f0712Yes
--primary-foregroundredoklch(0.971 0.013 17.38)#fef2f2Yes
--secondaryredoklch(0.274 0.006 286.033)#27272aYes
--secondary-foregroundredoklch(0.985 0 0)#fafafaYes
--mutedoklch(0.269 0 0)#262626Yes
--muted-foregroundoklch(0.708 0 0)#a1a1a1Yes
--accentoklch(0.269 0 0)#262626Yes
--accent-foregroundoklch(0.985 0 0)#fafafaYes
--destructiveoklch(0.704 0.191 22.216)#ff6467No — hex is clipped
--borderoklch(1 0 0 / 10%)#ffffff (10% alpha)Yes
--inputoklch(1 0 0 / 15%)#ffffff (15% alpha)Yes
--ringoklch(0.556 0 0)#737373Yes
--chart-1redoklch(0.808 0.114 19.571)#ffa2a2No — hex is clipped
--chart-2redoklch(0.637 0.237 25.331)#fb2c36Yes
--chart-3redoklch(0.577 0.245 27.325)#e7000bNo — hex is clipped
--chart-4redoklch(0.505 0.213 27.518)#c10007No — hex is clipped
--chart-5redoklch(0.444 0.177 26.899)#9f0712Yes
--sidebaroklch(0.205 0 0)#171717Yes
--sidebar-foregroundoklch(0.985 0 0)#fafafaYes
--sidebar-primaryredoklch(0.637 0.237 25.331)#fb2c36Yes
--sidebar-primary-foregroundredoklch(0.971 0.013 17.38)#fef2f2Yes
--sidebar-accentoklch(0.269 0 0)#262626Yes
--sidebar-accent-foregroundoklch(0.985 0 0)#fafafaYes
--sidebar-borderoklch(1 0 0 / 10%)#ffffff (10% alpha)Yes
--sidebar-ringoklch(0.556 0 0)#737373Yes

Contrast audit (WCAG 2)

19 of 22 checked pairs meet AA 4.5:1. Pairs with a translucent side are skipped. A suggested fix keeps hue and chroma and moves the foreground's lightness to the nearest AA value, using the same logic as the contrast checker.

light mode
PairRatioAPCA LcAA 4.5AA large 3Fix / details
foreground on background#0a0a0a on #ffffff19.79:1106PassPassPair page →
card-foreground on card#0a0a0a on #ffffff19.79:1106PassPassPair page →
popover-foreground on popover#0a0a0a on #ffffff19.79:1106PassPassPair page →
primary-foreground on primary#fef2f2 on #c100075.86:1-77PassPass
secondary-foreground on secondary#18181b on #f4f4f516.11:198PassPass
muted-foreground on muted#737373 on #f5f5f54.34:167FailPassSet muted-foreground to oklch(0.516 0.000 0.0) (#676767, 5.18:1).
muted-foreground on background#737373 on #ffffff4.74:173PassPassPair page →
accent-foreground on accent#171717 on #f5f5f516.44:199PassPass
destructive on background#e7000b on #ffffff4.76:170PassPassPair page →
sidebar-foreground on sidebar#0a0a0a on #fafafa18.96:1103PassPass
sidebar-primary-foreground on sidebar-primary#fef2f2 on #e7000b4.35:1-69FailPassNo AA lightness found for sidebar-primary-foreground.
dark mode
PairRatioAPCA LcAA 4.5AA large 3Fix / details
foreground on background#fafafa on #0a0a0a18.96:1-104PassPass
card-foreground on card#fafafa on #17171717.17:1-104PassPass
popover-foreground on popover#fafafa on #17171717.17:1-104PassPass
primary-foreground on primary#fef2f2 on #9f07127.63:1-84PassPass
secondary-foreground on secondary#fafafa on #27272a14.27:1-101PassPass
muted-foreground on muted#a1a1a1 on #2626265.85:1-48PassPass
muted-foreground on background#a1a1a1 on #0a0a0a7.66:1-51PassPass
accent-foreground on accent#fafafa on #26262614.49:1-101PassPass
destructive on background#ff6467 on #0a0a0a6.85:1-47PassPass
sidebar-foreground on sidebar#fafafa on #17171717.17:1-104PassPass
sidebar-primary-foreground on sidebar-primary#fef2f2 on #fb2c363.48:1-62FailPassSet sidebar-primary-foreground to oklch(0.211 0.013 17.4) (#1e1616, 4.66:1).

Copy code

These are only the variables the Red accent theme overrides. Add them after a base colour's variables in your globals.css.

shadcn/ui v4 globals.css (OKLCH)

:root {
  --primary: oklch(0.505 0.213 27.518);
  --primary-foreground: oklch(0.971 0.013 17.38);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --chart-1: oklch(0.808 0.114 19.571);
  --chart-2: oklch(0.637 0.237 25.331);
  --chart-3: oklch(0.577 0.245 27.325);
  --chart-4: oklch(0.505 0.213 27.518);
  --chart-5: oklch(0.444 0.177 26.899);
  --sidebar-primary: oklch(0.577 0.245 27.325);
  --sidebar-primary-foreground: oklch(0.971 0.013 17.38);
}

.dark {
  --primary: oklch(0.444 0.177 26.899);
  --primary-foreground: oklch(0.971 0.013 17.38);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --chart-1: oklch(0.808 0.114 19.571);
  --chart-2: oklch(0.637 0.237 25.331);
  --chart-3: oklch(0.577 0.245 27.325);
  --chart-4: oklch(0.505 0.213 27.518);
  --chart-5: oklch(0.444 0.177 26.899);
  --sidebar-primary: oklch(0.637 0.237 25.331);
  --sidebar-primary-foreground: oklch(0.971 0.013 17.38);
}

Tailwind v4 @theme inline mapping

@theme inline {
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
}

Hex fallback (for tools without OKLCH support)

:root {
  --primary: #c10007;
  --primary-foreground: #fef2f2;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --chart-1: #ffa2a2;
  --chart-2: #fb2c36;
  --chart-3: #e7000b;
  --chart-4: #c10007;
  --chart-5: #9f0712;
  --sidebar-primary: #e7000b;
  --sidebar-primary-foreground: #fef2f2;
}

.dark {
  --primary: #9f0712;
  --primary-foreground: #fef2f2;
  --secondary: #27272a;
  --secondary-foreground: #fafafa;
  --chart-1: #ffa2a2;
  --chart-2: #fb2c36;
  --chart-3: #e7000b;
  --chart-4: #c10007;
  --chart-5: #9f0712;
  --sidebar-primary: #fb2c36;
  --sidebar-primary-foreground: #fef2f2;
}

Related colours

Light primary: oklch(0.505 0.213 27.518) · #c10007

← All shadcn/ui themes