Skip to content

Customization

The theme provides a branded Hero component for splash pages. Configure it through standard Starlight frontmatter in your index.mdx:

---
title: My Docs Site
template: splash
hero:
tagline: A description of your project
image:
file: ../../assets/logo.png
actions:
- text: Get Started
link: /getting-started/
icon: right-arrow
variant: primary
- text: GitHub
link: https://github.com/your-org/your-repo
icon: github
variant: minimal
---

Any content below the frontmatter in index.mdx renders normally after the hero.

The hero supports two layouts, configured through the plugin:

// Centered (default) — image above title, everything centered
northwesternTheme({
homepage: { layout: "centered" },
})
// Split — text and buttons on the left, image on the right (60/40)
northwesternTheme({
homepage: { layout: "split" },
})

When no image is provided in frontmatter, the hero renders the title, tagline, and buttons in a centered layout regardless of the layout setting.

If your hero image is a lockup that already contains the project name, hide the title to avoid redundancy:

northwesternTheme({
homepage: {
layout: "centered",
showTitle: false,
},
})

By default, hero images are capped at 500px wide. For wider lockup images, increase it:

northwesternTheme({
homepage: {
showTitle: false,
imageWidth: "750px",
},
})

The value must be in pixels (e.g., "500px", "750px", "1000px").

The theme ships Northwestern’s official favicon and applies it automatically. Remove any manual favicon entry from your Starlight config and delete the favicon from public/ if present.

To use your own favicon instead, set favicon in your Starlight config as usual:

starlight({
favicon: "/my-custom-favicon.png",
plugins: [northwesternTheme()],
});

Use separate images for each theme:

hero:
image:
dark: ../../assets/logo-dark.png
light: ../../assets/logo-light.png
alt: Project logo

If you need a completely custom hero, override it in your Starlight config. The theme will not replace it:

starlight({
components: {
Hero: "./src/components/MyHero.astro",
},
plugins: [northwesternTheme()],
});

The theme overrides three Starlight components by default:

ComponentTheme VersionPurpose
HeroCentered layout with wide image supportBranded splash page
EditLinkConditionalEditLinkHides edit link on homepage
ThemeSelectThemeToggleAnimated sun/moon toggle

All three respect existing overrides. If you set Hero, EditLink, or ThemeSelect in your Starlight components config, the theme keeps your version.

Mermaid support is opt-in. When enabled, the theme applies Northwestern colors to all diagram types and adds a completely custom fullscreen viewer with pan/zoom, SVG download, source copying, and touch support.

Install astro-mermaid and mermaid, then add the integration:

import { northwesternMermaid } from "@nu-appdev/northwestern-starlight-theme/mermaid";
export default defineConfig({
integrations: [
northwesternMermaid(),
starlight({
plugins: [northwesternTheme()],
}),
],
});

Pass options to override defaults:

northwesternMermaid({
mermaidConfig: {
themeVariables: {
fontSize: "16px",
},
},
});

The theme configures GitHub syntax highlighting themes (github-dark / github-light) by default.

For opt-in line numbers, create ec.config.mjs at your docs project root:

import { defineEcConfig } from "@astrojs/starlight/expressive-code";
import { northwesternExpressiveCode } from "@nu-appdev/northwestern-starlight-theme/expressive-code";
export default defineEcConfig(northwesternExpressiveCode());

Then use showLineNumbers on individual code blocks:

```ts showLineNumbers title="example.ts"
const x = 1;
```

The theme loads its CSS before your project’s customCss, so you can override any token or style in your own CSS files.

starlight({
plugins: [northwesternTheme()],
customCss: ["./src/styles/overrides.css"],
});

The theme defines Northwestern design tokens as CSS custom properties. You can reference or override these in your own styles:

VariableValueUsage
--nu-purple-100#4e2a84Brand primary
--nu-purple-120#401f68Navigation background
--nu-purple-40#a495c3Dark mode accent

See src/styles/variables.css in the theme package for the full token list.

VariableValue
--nu-font-bodyAkkurat Pro, system fallbacks
--nu-font-headingPoppins, Akkurat Pro, system fallbacks
VariableValueUsage
--nu-color-success#008656Success states
--nu-color-info#5091cdInfo states
--nu-color-warning#ffc520Warning states
--nu-color-danger#ef553fDanger states