Guide 09
Themes
cngxjs (opens in new tab)Updated Guide09of 13
Eight themes ship in the box. A theme is a CSS file that overrides any subset of the--color-cdx-* design tokens. About 101 tokens total, grouped by purpose. Unspecified tokens fall back to the default theme.
Bundled themes
Slate Noir
--theme defaultPure neutral greys. The opinion-free default.
Ocean
--theme oceanDeep teal, cool surfaces, soft tension borders.
Midnight
--theme midnightIndigo night, low contrast, focus-friendly.
Nord
--theme nordArctic palette, frost blue, calm primary.
Rose Pine
--theme rose-pineWarm rose, muted greens, golden accents.
Ember
--theme emberWarm amber on ember-grey, low-glare reading.
Neon
--theme neonHigh-contrast electric primary on dark slate.
Brutalist
--theme brutalistHard edges, raw concrete, maximum legibility.
Each theme picks a Shiki light/dark pair to match. Ocean usesgithub-light / github-dark, Midnight uses tokyo-night, Neon uses synthwave-84, and so on.
Switching themes
# A bundled theme
--theme ocean
# Or your own CSS file
--theme ./my-brand.cssCustom logo & favicon
Branding the docs goes beyond colors. Pass a logo and a favicon via CLI flags or the JSON config. SVG works for the logo (it scales crisply in the sidebar header); SVG, ICO, or PNG works for the favicon. --customLogoDark adds a dark-mode variant, and--logoLayout sets whether the logo stands alone or next to the project name.
compodocx -p tsconfig.doc.json \
--theme ./my-brand.css \
--customLogo ./brand/logo.svg \
--customFavicon ./brand/favicon.icoOr pin all three in the JSON config so the team runs the same brand on every build:
{
"tsconfig": "tsconfig.doc.json",
"theme": "./my-brand.css",
"customLogo": "./brand/logo.svg",
"customFavicon": "./brand/favicon.ico"
}In a config file, relative paths resolve against the folder of that file; CLI flags resolve against the working directory. Drop the asset under ./brand/ or wherever your assets live; compodocx copies it into the static output.
Author a custom theme
Start from thetheme template (opens in new tab). Every token below is commented out so you uncomment exactly what you want to override. Both:root (light) and .dark blocks are supported. Omit .dark to use the same values in both modes.
:root {
--color-cdx-bg: hsl(220 20% 96%);
--color-cdx-text: hsl(220 30% 12%);
--color-cdx-primary: hsl(220 70% 40%);
}
.dark {
--color-cdx-bg: hsl(220 25% 8%);
--color-cdx-text: hsl(220 15% 92%);
--color-cdx-primary: hsl(220 80% 65%);
}Note for radii, fonts, and transitions: override the Tailwind alias tokens marked/* [TW] */ too. Otherwise @apply-generated utility classes don't pick up your values. Color tokens don't need aliases.
All available tokens
Every token compodocx exposes, grouped by purpose. Click a section to expand. Defaults shown are the light-mode values from theupstream template (opens in new tab).
Surface hierarchy5 tokens
Page, sidebar, cards, inline-code, fenced-code-block. The full vertical stack of background layers.
css--color-cdx-bg: hsl(220 16% 98%); --color-cdx-bg-alt: hsl(220 16% 96%); --color-cdx-bg-elevated: hsl(0 0% 100%); --color-cdx-bg-code: hsl(220 16% 95%); --color-cdx-bg-code-block: hsl(225 16% 16%);Text hierarchy4 tokens
Body, secondary, muted, and inverse. Match contrast carefully against the surfaces.
css--color-cdx-text: hsl(220 20% 14%); --color-cdx-text-secondary: hsl(220 12% 44%); --color-cdx-text-muted: hsl(220 10% 45%); --color-cdx-text-inverse: hsl(220 16% 96%);Primary accent3 tokens
Brand color, hover variant, and a subtle tint for backgrounds and rings.
css--color-cdx-primary: hsl(222 68% 52%); --color-cdx-primary-hover: hsl(222 68% 44%); --color-cdx-primary-subtle: hsl(222 68% 96%);Entity-type accents13 tokens
One color per entity kind. Used for sidebar dots, type chips, and dependency-graph nodes.
css--color-cdx-entity-component: #0e8578; --color-cdx-entity-service: #a56a07; --color-cdx-entity-directive: #7c3aed; --color-cdx-entity-pipe: #e2177b; --color-cdx-entity-module: #1e6ff5; --color-cdx-entity-class: #05875f; --color-cdx-entity-interface: #475569; --color-cdx-entity-guard: #eb1515; --color-cdx-entity-interceptor: #ba25cd; --color-cdx-entity-function: #52840b; --color-cdx-entity-variable: #617087; --color-cdx-entity-typealias: #6164f1; --color-cdx-entity-enum: #c2410c;Badge base colors21 tokens
Each badge derives text, border, and background from one base color via color-mix(). Override the base only.
css--color-cdx-badge-standalone: hsl(170 55% 38%); --color-cdx-badge-token: hsl(260 50% 48%); --color-cdx-badge-beta: hsl(35 75% 42%); --color-cdx-badge-factory: hsl(200 50% 42%); --color-cdx-badge-zoneless: hsl(280 45% 48%); --color-cdx-badge-breaking: hsl(0 65% 45%); --color-cdx-badge-signal: hsl(210 60% 42%); --color-cdx-badge-computed: hsl(270 50% 45%); --color-cdx-badge-effect: hsl(45 70% 40%); --color-cdx-badge-resource: hsl(190 55% 38%); --color-cdx-badge-model: hsl(240 45% 45%); --color-cdx-badge-after-render: hsl(25 65% 40%); --color-cdx-badge-after-next-render: hsl(15 65% 42%); --color-cdx-badge-after-every-render: hsl(5 60% 42%); --color-cdx-badge-after-render-effect: hsl(340 55% 42%); --color-cdx-badge-input: hsl(145 50% 35%); --color-cdx-badge-output: hsl(350 50% 42%); --color-cdx-badge-view-child: hsl(165 50% 35%); --color-cdx-badge-content-child: hsl(55 60% 35%); --color-cdx-badge-inject: hsl(320 45% 45%); --color-cdx-badge-host: hsl(180 50% 35%);Modifier base colors5 tokens
Visibility and lifecycle modifiers. Same color-mix() derivation as badges.
css--color-cdx-mod-private: hsl(0 50% 40%); --color-cdx-mod-protected: hsl(35 60% 35%); --color-cdx-mod-readonly: hsl(210 50% 40%); --color-cdx-mod-static: hsl(270 40% 42%); --color-cdx-mod-async: hsl(170 45% 32%);Status, overlay, feedback6 tokens
Coverage report, deprecation banners, modal backdrops, and the danger color for destructive UI.
css--color-cdx-status-pass: #16a34a; --color-cdx-status-fail: #ef4444; --color-cdx-status-warning: #ca8a04; --color-cdx-overlay: hsl(220 20% 14% / 0.4); --color-cdx-deprecated: hsl(38 92% 32.5%); --color-cdx-danger: hsl(0 72% 51%);Borders & shadows6 tokens
Three border weights (default, strong, focus) plus the standard shadow ramp for elevated surfaces.
css--color-cdx-border: hsl(220 14% 90%); --color-cdx-border-strong: hsl(220 14% 59%); --color-cdx-border-focus: hsl(222 68% 52%); --shadow-cdx-sm: 0 1px 2px hsl(220 20% 14% / 0.06); --shadow-cdx-md: 0 4px 12px hsl(220 20% 14% / 0.08); --shadow-cdx-lg: 0 12px 32px hsl(220 20% 14% / 0.12);Typography5 tokens
Heading, body, and code stacks. Tokens marked [TW] are Tailwind aliases needed when you @apply utility classes.
css--font-heading: "Instrument Sans", system-ui, sans-serif; --font-body: "Source Sans 3", system-ui, sans-serif; --font-code: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; --font-sans: "Source Sans 3", system-ui, sans-serif; /* [TW] */ --font-mono: ui-monospace, "SF Mono", Menlo, monospace; /* [TW] */Radii7 tokens
Three semantic radii plus four Tailwind aliases. Override the [TW] tokens too if you @apply rounded utilities.
css--radius-cdx-sm: 4px; --radius-cdx-md: 8px; --radius-cdx-lg: 12px; --radius-sm: 4px; /* [TW] */ --radius-md: 8px; /* [TW] */ --radius-lg: 12px; /* [TW] */ --radius-2xl: 12px; /* [TW] */Spacing7 tokens
Six general spacing steps plus the sidebar width. Component spacing also uses these.
css--spacing-cdx-xs: 4px; --spacing-cdx-sm: 8px; --spacing-cdx-md: 12px; --spacing-cdx-lg: 16px; --spacing-cdx-xl: 20px; --spacing-cdx-2xl: 24px; --spacing-cdx-sidebar: 320px;Code blocks13 tokens
Fenced code, the source viewer, line numbers, line highlights, copy button, and the language chip in code-snippet headers.
css--color-cdx-snippet-bg: hsl(220 14% 96%); --color-cdx-snippet-border: transparent; --color-cdx-snippet-radius: var(--radius-cdx-md); --color-cdx-code-inline: #c2185b; --color-cdx-code-dark-surface: hsl(225 16% 14%); --color-cdx-scrollbar: hsl(220 10% 50% / 0.4); --color-cdx-line-number: hsl(220 10% 50% / 0.5); --color-cdx-line-hover: hsl(220 20% 14% / 0.06); --color-cdx-line-highlight: hsl(48 96% 53% / 0.25); --color-cdx-line-highlight-flash: hsl(48 96% 53% / 0.3); --color-cdx-copy-success: hsl(142 50% 40%); --color-cdx-lang-chip: hsl(220 10% 60%); --color-cdx-lang-chip-bg: hsl(220 10% 50% / 0.1);Graphs4 tokens
Dependency-graph and DOM-tree chrome. Default to bg-alt + transparent border.
css--color-cdx-graph-bg: var(--color-cdx-bg-alt); --color-cdx-graph-border: transparent; --color-cdx-graph-border-width: 0; --color-cdx-graph-radius: var(--radius-cdx-md);Transitions2 tokens
Two timing tokens used across hovers, focus rings, and disclosure widgets.
css--cdx-transition-fast: 120ms ease; --cdx-transition-base: 200ms ease;
Documenting your own tokens
Components can document their theming surface with comments in their stylesheets:/// above SCSS variables, /** */ above CSS custom properties and @property rules. Use@overview for a description and @type /@default / @group per token, plus@example, @since,@deprecated, and @see. The component page surfaces a Theming tab with a grouped catalog and an optional source preview.
- Hook tokens.
@csspropdocuments a property a component only reads and never sets. - Mixins and functions. A
///block above an SCSS@mixinor@functionadds it to a Mixins section. - Free-standing sheets. The config-only
styleFileskey adds files no component reads.@themes Namelinks a file to the components and directives it themes, and tokens no symbol claims collect on adesign-tokens.htmlpage. - Hidden tokens.
@internalhides one token, and custom properties starting with--_stay out of the docs (seethemingPrivatePrefix).