Subcomponent for shadcn/ui

Subcomponent is a shadcn/ui theme built around a green primary color (#48cb55) with purple accents (#cb48be). The light mode uses a neutral background (#f7fdf7). Dark mode keeps the green primary (#48cb55) on a green-tinted background (#041005).

Color palette

TokenLightDark
Background
#f7fdf7mintcream
#041005black
Foreground
#010401black
#f5faf5whitesmoke
Card
#f7fdf7mintcream
#041005black
Card foreground
#010401black
#f5faf5whitesmoke
Popover
#f7fdf7mintcream
#041005black
Popover foreground
#010401black
#f5faf5whitesmoke
Primary
#48cb55mediumseagreen
#48cb55mediumseagreen
Primary foreground
#103814darkgreen
#103814darkgreen
Secondary
#cb48bemediumorchid
#cb48bemediumorchid
Secondary foreground
#ffffffwhite
#ffffffwhite
Muted
#e7dee7gainsboro
#211820black
Muted foreground
#433d42darkslategray
#c2bcc2silver
Accent
#cb48bemediumorchid
#cb48bemediumorchid
Accent foreground
#ffffffwhite
#ffffffwhite
Destructive
#7d0707maroon
#e30d0dred
Destructive foreground
#fbbcbclightpink
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#48cb55mediumseagreen
#48cb55mediumseagreen

Contrast

WCAG 2 contrast ratios between each background and its foreground color.

Light mode
Text on background19.97:1AAA
Text on card19.97:1AAA
Primary button6.25:1AA
Secondary button4.02:1AA Large
Muted text8.09:1AAA
Accent4.02:1AA Large
Destructive6.81:1AA
Dark mode
Text on background18.34:1AAA
Text on card18.34:1AAA
Primary button6.25:1AA
Secondary button4.02:1AA Large
Muted text9.30:1AAA
Accent4.02:1AA Large
Destructive4.86:1AA

CSS variables

Paste this into your globals.css to use Subcomponent in your shadcn/ui project.

:root {
  --radius: 0.5rem;
  --background: oklch(0.988 0.01 148.476);
  --foreground: oklch(0.098 0.02 147.103);
  --muted: oklch(0.911 0.015 328.768);
  --muted-foreground: oklch(0.367 0.013 328.976);
  --popover: oklch(0.988 0.01 148.476);
  --popover-foreground: oklch(0.098 0.02 147.103);
  --card: oklch(0.988 0.01 148.476);
  --card-foreground: oklch(0.098 0.02 147.103);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.746 0.196 144.885);
  --primary-foreground: oklch(0.301 0.076 145.098);
  --secondary: oklch(0.623 0.212 332.007);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.623 0.212 332.007);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.375 0.148 28.405);
  --destructive-foreground: oklch(0.852 0.074 18.71);
  --ring: oklch(0.746 0.196 144.885);
  --chart-1: oklch(0.746 0.196 144.885);
  --chart-2: oklch(0.623 0.212 332.007);
  --chart-3: oklch(0.623 0.212 332.007);
  --chart-4: oklch(0.643 0.201 331.715);
  --chart-5: oklch(0.754 0.204 144.732);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.158 0.031 146.896);
  --foreground: oklch(0.98 0.008 148.496);
  --muted: oklch(0.222 0.021 329.574);
  --muted-foreground: oklch(0.802 0.011 328.739);
  --popover: oklch(0.158 0.031 146.896);
  --popover-foreground: oklch(0.98 0.008 148.496);
  --card: oklch(0.158 0.031 146.896);
  --card-foreground: oklch(0.98 0.008 148.496);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.746 0.196 144.885);
  --primary-foreground: oklch(0.301 0.076 145.098);
  --secondary: oklch(0.623 0.212 332.007);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.623 0.212 332.007);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.577 0.232 28.807);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.746 0.196 144.885);
  --chart-1: oklch(0.746 0.196 144.885);
  --chart-2: oklch(0.623 0.212 332.007);
  --chart-3: oklch(0.623 0.212 332.007);
  --chart-4: oklch(0.643 0.201 331.715);
  --chart-5: oklch(0.754 0.204 144.732);
}