Necessary for shadcn/ui

Necessary is a shadcn/ui theme built around a purple primary color (#bb83be) with neutral gray accents (#e7e4e7). The light mode uses a neutral background (#ffffff). Dark mode keeps the purple primary (#bb83be) on a neutral background (#040104).

Color palette

TokenLightDark
Background
#ffffffwhite
#040104black
Foreground
#0c030dblack
#ffffffwhite
Card
#ffffffwhite
#040104black
Card foreground
#0c030dblack
#ffffffwhite
Popover
#ffffffwhite
#040104black
Popover foreground
#0c030dblack
#ffffffwhite
Primary
#bb83beorchid
#bb83beorchid
Primary foreground
#0a050ablack
#0a050ablack
Secondary
#e7e4e7gainsboro
#231a23black
Secondary foreground
#514851darkslategray
#c2acc3silver
Muted
#efe0f0lavender
#1e0f1fblack
Muted foreground
#605161dimgray
#ad9eaedarkgray
Accent
#e7e4e7gainsboro
#231a23black
Accent foreground
#514851darkslategray
#c2acc3silver
Destructive
#7f280asaddlebrown
#ee5f2ftomato
Destructive foreground
#fad0c2peachpuff
#000000black
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#bb83beorchid
#bb83beorchid

Contrast

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

Light mode
Text on background20.30:1AAA
Text on card20.30:1AAA
Primary button6.85:1AA
Secondary button6.94:1AA
Muted text5.84:1AA
Accent6.94:1AA
Destructive6.72:1AA
Dark mode
Text on background20.76:1AAA
Text on card20.76:1AAA
Primary button6.85:1AA
Secondary button8.04:1AAA
Muted text7.23:1AAA
Accent8.04:1AAA
Destructive6.32:1AA

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(1 0 180);
  --foreground: oklch(0.122 0.034 325.915);
  --muted: oklch(0.924 0.025 324.288);
  --muted-foreground: oklch(0.457 0.032 324.525);
  --popover: oklch(1 0 180);
  --popover-foreground: oklch(0.122 0.034 325.915);
  --card: oklch(1 0 180);
  --card-foreground: oklch(0.122 0.034 325.915);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.686 0.104 324.946);
  --primary-foreground: oklch(0.128 0.015 325.047);
  --secondary: oklch(0.922 0.005 324.162);
  --secondary-foreground: oklch(0.413 0.019 324.39);
  --accent: oklch(0.922 0.005 324.162);
  --accent-foreground: oklch(0.413 0.019 324.39);
  --destructive: oklch(0.407 0.127 37.006);
  --destructive-foreground: oklch(0.889 0.052 39.267);
  --ring: oklch(0.686 0.104 324.946);
  --chart-1: oklch(0.686 0.104 324.946);
  --chart-2: oklch(0.922 0.005 324.162);
  --chart-3: oklch(0.922 0.005 324.162);
  --chart-4: oklch(0.946 0.004 324.152);
  --chart-5: oklch(0.685 0.114 325.016);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.086 0.02 325.821);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.198 0.037 325.104);
  --muted-foreground: oklch(0.716 0.029 324.359);
  --popover: oklch(0.086 0.02 325.821);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.086 0.02 325.821);
  --card-foreground: oklch(1 0 180);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.686 0.104 324.946);
  --primary-foreground: oklch(0.128 0.015 325.047);
  --secondary: oklch(0.232 0.023 324.681);
  --secondary-foreground: oklch(0.771 0.04 324.426);
  --accent: oklch(0.232 0.023 324.681);
  --accent-foreground: oklch(0.771 0.04 324.426);
  --destructive: oklch(0.663 0.187 38.001);
  --destructive-foreground: oklch(0 0 0);
  --ring: oklch(0.686 0.104 324.946);
  --chart-1: oklch(0.686 0.104 324.946);
  --chart-2: oklch(0.232 0.023 324.681);
  --chart-3: oklch(0.232 0.023 324.681);
  --chart-4: oklch(0.263 0.028 324.716);
  --chart-5: oklch(0.685 0.114 325.016);
}