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.jsonCharter 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.
| Where | Pair | Light | Dark |
|---|---|---|---|
| Body text | foreground on background | 15.17:1 · Lc 102 | 15.92:1 · Lc 95 |
| Secondary text on the page | muted-foreground on background | 7.36:1 · Lc 86 | 9.42:1 · Lc 63 |
| Text in cards | card-foreground on card | 15.17:1 · Lc 102 | 14.41:1 · Lc 94 |
| Secondary text in cards | muted-foreground on card | 7.36:1 · Lc 86 | 8.53:1 · Lc 62 |
| Menus and popovers | popover-foreground on popover | 15.17:1 · Lc 102 | 14.41:1 · Lc 94 |
| Primary buttons | primary-foreground on primary | 5.12:1 · Lc 80 | 9.06:1 · Lc 63 |
| Links and outline accents | primary on background | 5.12:1 · Lc 74 | 9.04:1 · Lc 61 |
| Secondary buttons | secondary-foreground on secondary | 13.68:1 · Lc 95 | 13.55:1 · Lc 93 |
| Text on muted panels | muted-foreground on muted | 6.64:1 · Lc 78 | 8.02:1 · Lc 61 |
| Hovered menu items | accent-foreground on accent | 8.09:1 · Lc 81 | 10.43:1 · Lc 79 |
| Error messages | destructive on background | 6.54:1 · Lc 81 | 9.30:1 · Lc 63 |
| Sidebar | sidebar-foreground on sidebar | 14.65:1 · Lc 99 | 15.00:1 · Lc 94 |
| Sidebar active item | sidebar-primary-foreground on sidebar-primary | 5.12:1 · Lc 80 | 9.06:1 · Lc 63 |
| Sidebar hover | sidebar-accent-foreground on sidebar-accent | 13.68:1 · Lc 95 | 13.55:1 · Lc 93 |
| Focus ring | ring on background | 5.12:1 | 8.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.jsonOr 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-sansThe registry item: themes.dev/r/presets/charter.json. Free to use in any project.
: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.
