Skip to content

Charter, a shadcn/ui preset

A clear institutional blue with Public Sans, for civic and public services. It comes from Charter, one of our website themes.

Fonts: Public Sans · radius 0.125rem · light and dark · lowest text contrast 5.12:1

npx shadcn@latest add https://www.themes.dev/r/presets/charter.json
Edit in the generator

Charter on six free blocks from themes.dev UI. Scroll inside the preview.

The colours

The main variables, light and dark. The full set of 31 per mode, sidebar and charts included, is in the CSS below.

Light

  • background#ffffff
  • foreground#122255
  • primary#0b5fff
  • primary-foreground#ffffff
  • secondary#f6f2f3
  • muted-foreground#4f5666
  • accent#e8efff
  • border#dfe2e8
  • destructive#b3261e
  • ring#0b5fff
  • chart-1#98c1ff
  • chart-2#488aff
  • chart-3#2869ec
  • chart-4#1750c2
  • chart-5#083a9d

Dark

  • background#0e111b
  • foreground#e8ecf7
  • primary#90b3ff
  • primary-foreground#0a1024
  • secondary#1e212b
  • muted-foreground#afb7cc
  • accent#1b2645
  • border#2c3242
  • destructive#ff9c8a
  • ring#86a8ff
  • chart-1#9dc4ff
  • chart-2#5e9aff
  • chart-3#3476fa
  • chart-4#2059cc
  • chart-5#1143a7

Contrast, checked

Every pair shadcn/ui draws text with, measured as WCAG 2 contrast (AA needs 4.5:1) and APCA Lc (we ask 60 for text). Focus rings need 3:1 on the page.

WherePairLightDark
Body textforeground on background15.17:1 · Lc 10215.92:1 · Lc 95
Secondary text on the pagemuted-foreground on background7.36:1 · Lc 869.42:1 · Lc 63
Text in cardscard-foreground on card15.17:1 · Lc 10214.41:1 · Lc 94
Secondary text in cardsmuted-foreground on card7.36:1 · Lc 868.53:1 · Lc 62
Menus and popoverspopover-foreground on popover15.17:1 · Lc 10214.41:1 · Lc 94
Primary buttonsprimary-foreground on primary5.12:1 · Lc 809.06:1 · Lc 63
Links and outline accentsprimary on background5.12:1 · Lc 749.04:1 · Lc 61
Secondary buttonssecondary-foreground on secondary13.68:1 · Lc 9513.55:1 · Lc 93
Text on muted panelsmuted-foreground on muted6.64:1 · Lc 788.02:1 · Lc 61
Hovered menu itemsaccent-foreground on accent8.09:1 · Lc 8110.43:1 · Lc 79
Error messagesdestructive on background6.54:1 · Lc 819.30:1 · Lc 63
Sidebarsidebar-foreground on sidebar14.65:1 · Lc 9915.00:1 · Lc 94
Sidebar active itemsidebar-primary-foreground on sidebar-primary5.12:1 · Lc 809.06:1 · Lc 63
Sidebar hoversidebar-accent-foreground on sidebar-accent13.68:1 · Lc 9513.55:1 · Lc 93
Focus ringring on background5.12:18.11:1

Use it

With the shadcn CLI, in a project set up with shadcn init:

npx shadcn@latest add https://www.themes.dev/r/presets/charter.json

Or paste the CSS into globals.css (Next.js) or your main stylesheet (Vite, Astro), replacing the :root and .dark values that are there.

Then load the font:

npm i @fontsource-variable/public-sans

The registry item: themes.dev/r/presets/charter.json. Free to use in any project.

globals.css
:root {
  --radius: 0.125rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.273 0.095 266.76);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.273 0.095 266.76);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.273 0.095 266.76);
  --primary: oklch(0.552 0.248 262.15);
  --primary-foreground: oklch(1 0 0);
  --secondary: oklch(0.965 0.004 0);
  --secondary-foreground: oklch(0.273 0.095 266.76);
  --muted: oklch(0.965 0.004 0);
  --muted-foreground: oklch(0.453 0.028 266.61);
  --accent: oklch(0.952 0.023 266.62);
  --accent-foreground: oklch(0.412 0.206 262.94);
  --destructive: oklch(0.501 0.178 28.7);
  --border: oklch(0.912 0.009 264.52);
  --input: oklch(0.552 0.026 266.73);
  --ring: oklch(0.552 0.248 262.15);
  --chart-1: oklch(0.804 0.099 258.42);
  --chart-2: oklch(0.651 0.186 260.83);
  --chart-3: oklch(0.56 0.208 262.15);
  --chart-4: oklch(0.47 0.188 262.15);
  --chart-5: oklch(0.39 0.169 262.15);
  --sidebar: oklch(0.988 0 0);
  --sidebar-foreground: oklch(0.273 0.095 266.76);
  --sidebar-primary: oklch(0.552 0.248 262.15);
  --sidebar-primary-foreground: oklch(1 0 0);
  --sidebar-accent: oklch(0.965 0.004 0);
  --sidebar-accent-foreground: oklch(0.273 0.095 266.76);
  --sidebar-border: oklch(0.912 0.009 264.52);
  --sidebar-ring: oklch(0.552 0.248 262.15);
}

.dark {
  --background: oklch(0.18 0.02 269.26);
  --foreground: oklch(0.943 0.015 269.98);
  --card: oklch(0.227 0.022 269.58);
  --card-foreground: oklch(0.943 0.015 269.98);
  --popover: oklch(0.227 0.022 269.58);
  --popover-foreground: oklch(0.943 0.015 269.98);
  --primary: oklch(0.771 0.116 265.04);
  --primary-foreground: oklch(0.18 0.042 269.26);
  --secondary: oklch(0.25 0.02 269.26);
  --secondary-foreground: oklch(0.943 0.015 269.98);
  --muted: oklch(0.25 0.02 269.26);
  --muted-foreground: oklch(0.781 0.03 268.29);
  --accent: oklch(0.275 0.06 268.65);
  --accent-foreground: oklch(0.882 0.057 270.02);
  --destructive: oklch(0.79 0.122 31.06);
  --border: oklch(0.319 0.03 269.76);
  --input: oklch(0.616 0.048 270.95);
  --ring: oklch(0.742 0.132 266.98);
  --chart-1: oklch(0.814 0.094 258.1);
  --chart-2: oklch(0.692 0.162 260.38);
  --chart-3: oklch(0.6 0.208 262.15);
  --chart-4: oklch(0.5 0.188 262.15);
  --chart-5: oklch(0.42 0.169 262.15);
  --sidebar: oklch(0.21 0.02 269.26);
  --sidebar-foreground: oklch(0.943 0.015 269.98);
  --sidebar-primary: oklch(0.771 0.116 265.04);
  --sidebar-primary-foreground: oklch(0.18 0.042 269.26);
  --sidebar-accent: oklch(0.25 0.02 269.26);
  --sidebar-accent-foreground: oklch(0.943 0.015 269.98);
  --sidebar-border: oklch(0.319 0.03 269.76);
  --sidebar-ring: oklch(0.742 0.132 266.98);
}

@theme inline {
  --font-sans: "Public Sans Variable", "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --font-heading: "Public Sans Variable", "Public Sans", ui-sans-serif, system-ui, sans-serif;
}

The whole site

Charter started as Charter, a website theme

Charter is a complete site for Libraries and community services: every page, the content model and a live demo, built from the same blocks, in Astro and Next.js + Sanity. It comes with UI Pro, from €199 once, with every other theme.

More shadcn/ui presets

All 37 presets