Theme
Define your site’s color system with a theme.json file. This lets you tailor the look and feel of your documentation without changing content.
theme.json
Place a theme.json at your project root (the same directory where you execute npx doccupine). It supports multiple modes. Define a default mode and a dark mode.
{
"default": {
"primaryLight": "#93c5fd",
"primary": "#2563eb",
"primaryDark": "#1e40af",
"secondaryLight": "#c4b5fd",
"secondary": "#8b5cf6",
"secondaryDark": "#5b21b6",
"tertiaryLight": "#fbbf24",
"tertiary": "#f59e0b",
"tertiaryDark": "#d97706",
"grayLight": "#f3f4f6",
"gray": "#9ca3af",
"grayDark": "#374151",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#000000",
"light": "#ffffff"
},
"dark": {
"primaryLight": "#9bcaff",
"primary": "#1e7ae0",
"primaryDark": "#033d7e",
"secondaryLight": "#ddd6fe",
"secondary": "#a78bfa",
"secondaryDark": "#7c3aed",
"tertiaryLight": "#fed7aa",
"tertiary": "#fb923c",
"tertiaryDark": "#ea580c",
"grayLight": "#1f2937",
"gray": "#6b7280",
"grayDark": "#9ca3af",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#ffffff",
"light": "#000000"
},
"logo": {
"dark": "https://docs.doccupine.com/logo-dark.svg",
"light": "https://docs.doccupine.com/logo-light.svg"
}
}Modes
- default: The base color palette for your site.
- dark: Dark‑mode palette.
Fields
- primaryLight: A lighter variant of your brand color, used for subtle accents and backgrounds.
- primary: The main brand color.
- primaryDark: A darker variant of your brand color for emphasis and hover states.
- secondaryLight: A lighter variant of your secondary color, used for subtle accents and backgrounds.
- secondary: The secondary brand color used for highlights and UI accents.
- secondaryDark: A darker variant of your secondary color for emphasis and hover states.
- tertiaryLight: A lighter variant of your tertiary color, used for subtle accents and backgrounds.
- tertiary: The tertiary accent color.
- tertiaryDark: A darker variant of your tertiary color for emphasis and hover states.
- grayLight: Light gray for surfaces and borders.
- gray: Neutral gray for text and UI elements.
- grayDark: Dark gray for headings or high‑contrast text.
- success: Positive/confirmation color.
- error: Error/destructive color.
- warning: Warning/attention color.
- info: Informational/highlight color.
- dark: The darkest/base color (often page background in dark mode).
- light: The lightest/base color (often page background in light mode).
- logo.light: Path or URL to the logo used on light backgrounds. Recommended size: 164×30 px.
- logo.dark: Path or URL to the logo used on dark backgrounds. Recommended size: 164×30 px.
Behavior
- Placement: Put
theme.jsonin the project root alongsideconfig.json. - Partial palettes: A key missing from a mode uses the built-in color for that mode.
- Logo size: Recommended dimensions are 164px width and 30px height.
- Light or dark: Visitors see the mode their operating system is set to, and the site follows it live if they change it, until they pick a mode with the theme toggle. That choice is remembered on their device.
- Browser chrome: The
theme-colorshown in browser UI (such as the iOS Safari status bar) is derived from each mode'sprimarytoken, so it carries your brand color in both modes.
Use plain CSS colors: hex (e.g., #22c55e), a color name, or a color function such as rgb() or oklch(). Any other value is ignored with a warning and the default color for that key is used.
Tips
- Contrast: Ensure sufficient contrast between text and backgrounds for readability.
- Branding: Start with your brand’s
primarycolor, then deriveprimaryLightandprimaryDark. - Iterate: Adjust colors and refresh the site to preview changes quickly.
Custom CSS
The site is styled with plain CSS, not a CSS-in-JS library, and its class names and variables stay the same from release to release, so CSS written against them keeps working when you update Doccupine.
Colors and shadows
Every color and shadow is a CSS variable. Light values sit on :root and dark values on :root.dark (the dark class on <html> switches the mode):
--color-<key>: one pertheme.jsonkey, such as--color-primaryand--color-grayDark.--color-accent,--color-accentStrong,--color-accentMuted,--color-surface,--color-link: derived from the palette for each mode.--color-<key>-fill,--color-on-<key>,--color-<key>-text(forprimary,secondary,tertiary,success,warning,error,info), their-hoverforms, and--color-text-muted: colors computed from your palette to reach WCAG AA contrast (4.5:1).--color-primary-fillis the primary color as a filled surface (buttons, solid badges) and--color-on-primaryits label: white on the color nudged slightly darker, or the color itself with dark text when white would need it much darker (amber, yellow, light green, pastels).--color-primary-textis the primary color as text on the page, and--color-text-mutedisgrayadjusted for small text. Colors that already pass are used as they are.--shadow-xsthrough--shadow-xl.--mermaid-bg,--mermaid-fg,--mermaid-line,--mermaid-accent,--mermaid-muted,--mermaid-surface,--mermaid-border: the diagram colors (see Mermaid).
Add the light-only or dark-only class to an element to show it in one mode only.
Class names
Components carry stable dcp- class names: dcp-<component> on the component (dcp-header, dcp-sidebar, dcp-docs for the article, dcp-callout, dcp-card, dcp-code, dcp-tabs, ...) and dcp-<component>__<part> on its parts (dcp-header__inner, dcp-code__title). Variants and states are attributes, not extra classes: data-type="warning" on a callout, aria-selected="true" on the active tab, aria-current="page" on the current sidebar link.
Cascade layers
The built-in styles live in cascade layers, in this order: reset, tokens, base, components, design, utilities. Rules outside any layer win over every layer, whatever their specificity, so CSS of your own needs no !important as long as it is not inside an @layer block (or sits in a layer declared after these).
/* A deeper accent in dark mode only. */
:root.dark {
--color-primary: #1d4ed8;
}
/* Squarer callouts. */
.dcp-callout {
border-radius: 4px;
}Demo
In the following demos, you can see how the theme can be changed. To override the theme, create a theme.json file in the project root and copy paste the code below.
Purple
{
"default": {
"primaryLight": "#c4b5fd",
"primary": "#8b5cf6",
"primaryDark": "#5b21b6",
"secondaryLight": "#86efac",
"secondary": "#22c55e",
"secondaryDark": "#15803d",
"tertiaryLight": "#fbbf24",
"tertiary": "#f59e0b",
"tertiaryDark": "#d97706",
"grayLight": "#f3f4f6",
"gray": "#9ca3af",
"grayDark": "#374151",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#000000",
"light": "#ffffff"
},
"dark": {
"primaryLight": "#ddd6fe",
"primary": "#a78bfa",
"primaryDark": "#7c3aed",
"secondaryLight": "#6ee7b7",
"secondary": "#10b981",
"secondaryDark": "#065f46",
"tertiaryLight": "#fed7aa",
"tertiary": "#fb923c",
"tertiaryDark": "#ea580c",
"grayLight": "#1f2937",
"gray": "#6b7280",
"grayDark": "#9ca3af",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#ffffff",
"light": "#000000"
}
}Green
{
"default": {
"primaryLight": "#86efac",
"primary": "#22c55e",
"primaryDark": "#15803d",
"secondaryLight": "#c4b5fd",
"secondary": "#8b5cf6",
"secondaryDark": "#5b21b6",
"tertiaryLight": "#fbbf24",
"tertiary": "#f59e0b",
"tertiaryDark": "#d97706",
"grayLight": "#f3f4f6",
"gray": "#9ca3af",
"grayDark": "#374151",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#000000",
"light": "#ffffff"
},
"dark": {
"primaryLight": "#6ee7b7",
"primary": "#10b981",
"primaryDark": "#065f46",
"secondaryLight": "#ddd6fe",
"secondary": "#a78bfa",
"secondaryDark": "#7c3aed",
"tertiaryLight": "#fed7aa",
"tertiary": "#fb923c",
"tertiaryDark": "#ea580c",
"grayLight": "#1f2937",
"gray": "#6b7280",
"grayDark": "#9ca3af",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#ffffff",
"light": "#000000"
}
}Yellow
{
"default": {
"primaryLight": "#fbbf24",
"primary": "#f59e0b",
"primaryDark": "#d97706",
"secondaryLight": "#c4b5fd",
"secondary": "#8b5cf6",
"secondaryDark": "#5b21b6",
"tertiaryLight": "#86efac",
"tertiary": "#22c55e",
"tertiaryDark": "#15803d",
"grayLight": "#f3f4f6",
"gray": "#9ca3af",
"grayDark": "#374151",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#000000",
"light": "#ffffff"
},
"dark": {
"primaryLight": "#fed7aa",
"primary": "#fb923c",
"primaryDark": "#ea580c",
"secondaryLight": "#ddd6fe",
"secondary": "#a78bfa",
"secondaryDark": "#7c3aed",
"tertiaryLight": "#6ee7b7",
"tertiary": "#10b981",
"tertiaryDark": "#065f46",
"grayLight": "#1f2937",
"gray": "#6b7280",
"grayDark": "#9ca3af",
"success": "#10b981",
"error": "#f43f5e",
"warning": "#f59e0b",
"info": "#3b82f6",
"dark": "#ffffff",
"light": "#000000"
}
}