Margin, a shadcn/ui preset
Periwinkle with Hanken Grotesk: Copybook’s second set. It comes from Copybook, one of our website themes.
Fonts: Hanken Grotesk · radius 0.875rem · light and dark · lowest text contrast 4.56:1
npx shadcn@latest add https://www.themes.dev/r/presets/margin.jsonMargin 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#111316
- primary#7364de
- primary-foreground#ffffff
- secondary#f6f2f3
- muted-foreground#50555c
- accent#eeecfe
- border#e3e4e8
- destructive#b42318
- ring#111316
- chart-1#b9b5ff
- chart-2#8a7ff2
- chart-3#6e63c8
- chart-4#554ba3
- chart-5#413782
Dark
- background#0f1114
- foreground#ecedeb
- primary#afa9ff
- primary-foreground#111316
- secondary#1e2126
- muted-foreground#b1b7be
- accent#252446
- border#2a2e34
- destructive#ff9788
- ring#8a7dfa
- chart-1#bcb9ff
- chart-2#968cff
- chart-3#7970d5
- chart-4#5d54ad
- chart-5#48408c
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 | 18.60:1 · Lc 105 | 16.10:1 · Lc 95 |
| Secondary text on the page | muted-foreground on background | 7.50:1 · Lc 86 | 9.35:1 · Lc 63 |
| Text in cards | card-foreground on card | 17.30:1 · Lc 100 | 14.71:1 · Lc 95 |
| Secondary text in cards | muted-foreground on card | 6.97:1 · Lc 81 | 8.54:1 · Lc 62 |
| Menus and popovers | popover-foreground on popover | 17.30:1 · Lc 100 | 14.71:1 · Lc 95 |
| Primary buttons | primary-foreground on primary | 4.56:1 · Lc 77 | 8.82:1 · Lc 62 |
| Links and outline accents | primary on background | 4.56:1 · Lc 71 | 8.96:1 · Lc 61 |
| Secondary buttons | secondary-foreground on secondary | 16.78:1 · Lc 98 | 13.75:1 · Lc 94 |
| Text on muted panels | muted-foreground on muted | 6.76:1 · Lc 79 | 7.98:1 · Lc 61 |
| Hovered menu items | accent-foreground on accent | 8.16:1 · Lc 81 | 8.95:1 · Lc 71 |
| Error messages | destructive on background | 6.58:1 · Lc 81 | 9.02:1 · Lc 61 |
| Sidebar | sidebar-foreground on sidebar | 17.97:1 · Lc 103 | 15.19:1 · Lc 95 |
| Sidebar active item | sidebar-primary-foreground on sidebar-primary | 4.56:1 · Lc 77 | 8.82:1 · Lc 62 |
| Sidebar hover | sidebar-accent-foreground on sidebar-accent | 16.78:1 · Lc 98 | 13.75:1 · Lc 94 |
| Focus ring | ring on background | 18.60:1 | 5.75: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/margin.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/hanken-groteskThe registry item: themes.dev/r/presets/margin.json. Free to use in any project.
:root {
--radius: 0.875rem;
--background: oklch(1 0 0);
--foreground: oklch(0.186 0.007 258.37);
--card: oklch(0.975 0.003 286.35);
--card-foreground: oklch(0.186 0.007 258.37);
--popover: oklch(0.975 0.003 286.35);
--popover-foreground: oklch(0.186 0.007 258.37);
--primary: oklch(0.58 0.18 285.08);
--primary-foreground: oklch(1 0 0);
--secondary: oklch(0.965 0.004 0);
--secondary-foreground: oklch(0.186 0.007 258.37);
--muted: oklch(0.965 0.004 0);
--muted-foreground: oklch(0.448 0.013 256.75);
--accent: oklch(0.95 0.024 291.04);
--accent-foreground: oklch(0.412 0.194 277.41);
--destructive: oklch(0.5 0.182 29.51);
--border: oklch(0.919 0.006 274.96);
--input: oklch(0.557 0.014 255.56);
--ring: oklch(0.186 0.007 258.37);
--chart-1: oklch(0.804 0.103 285.91);
--chart-2: oklch(0.66 0.166 285.08);
--chart-3: oklch(0.56 0.151 285.08);
--chart-4: oklch(0.47 0.137 285.08);
--chart-5: oklch(0.39 0.122 285.08);
--sidebar: oklch(0.988 0 0);
--sidebar-foreground: oklch(0.186 0.007 258.37);
--sidebar-primary: oklch(0.58 0.18 285.08);
--sidebar-primary-foreground: oklch(1 0 0);
--sidebar-accent: oklch(0.965 0.004 0);
--sidebar-accent-foreground: oklch(0.186 0.007 258.37);
--sidebar-border: oklch(0.919 0.006 274.96);
--sidebar-ring: oklch(0.186 0.007 258.37);
}
.dark {
--background: oklch(0.177 0.007 258.37);
--foreground: oklch(0.945 0.003 128.49);
--card: oklch(0.221 0.009 255.61);
--card-foreground: oklch(0.945 0.003 128.49);
--popover: oklch(0.221 0.009 255.61);
--popover-foreground: oklch(0.945 0.003 128.49);
--primary: oklch(0.773 0.121 286);
--primary-foreground: oklch(0.186 0.007 258.37);
--secondary: oklch(0.247 0.011 258.37);
--secondary-foreground: oklch(0.945 0.003 128.49);
--muted: oklch(0.247 0.011 258.37);
--muted-foreground: oklch(0.777 0.012 252.12);
--accent: oklch(0.281 0.06 283.22);
--accent-foreground: oklch(0.843 0.083 289.06);
--destructive: oklch(0.781 0.128 29.18);
--border: oklch(0.3 0.012 258.37);
--input: oklch(0.618 0.014 255.55);
--ring: oklch(0.66 0.18 285.08);
--chart-1: oklch(0.814 0.098 285.9);
--chart-2: oklch(0.7 0.164 285.15);
--chart-3: oklch(0.6 0.151 285.08);
--chart-4: oklch(0.5 0.137 285.08);
--chart-5: oklch(0.42 0.122 285.08);
--sidebar: oklch(0.207 0.007 258.37);
--sidebar-foreground: oklch(0.945 0.003 128.49);
--sidebar-primary: oklch(0.773 0.121 286);
--sidebar-primary-foreground: oklch(0.186 0.007 258.37);
--sidebar-accent: oklch(0.247 0.011 258.37);
--sidebar-accent-foreground: oklch(0.945 0.003 128.49);
--sidebar-border: oklch(0.3 0.012 258.37);
--sidebar-ring: oklch(0.66 0.18 285.08);
}
@theme inline {
--font-sans: "Hanken Grotesk Variable", "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
--font-heading: "Hanken Grotesk Variable", "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
}
The whole site
Margin started as Copybook, a website theme
Copybook is a complete site for Course providers and colleges: 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.
