Customization
Homepage Hero
Section titled “Homepage Hero”The theme provides a branded Hero component for splash pages. Configure it through standard Starlight frontmatter in your index.mdx:
---title: My Docs Sitetemplate: splashhero: 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.
Layout Options
Section titled “Layout Options”The hero supports two layouts, configured through the theme key:
// Centered (default) — image above title, everything centereddefineNorthwesternConfig({ starlight: { title: "My Docs" }, theme: { homepage: { layout: "centered" } },})
// Split — text and buttons on the left, image on the right (60/40)defineNorthwesternConfig({ starlight: { title: "My Docs" }, theme: { 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.
Hiding the Title
Section titled “Hiding the Title”If your hero image is a lockup that already contains the project name, hide the title to avoid redundancy:
defineNorthwesternConfig({ starlight: { title: "My Docs" }, theme: { homepage: { layout: "centered", showTitle: false, }, },})Image Width
Section titled “Image Width”By default, hero images are capped at 500px wide. For wider lockup images, increase it:
defineNorthwesternConfig({ starlight: { title: "My Docs" }, theme: { homepage: { showTitle: false, imageWidth: "750px", }, },})The value must be in pixels (e.g., "500px", "750px", "1000px").
Favicon
Section titled “Favicon”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:
defineNorthwesternConfig({ starlight: { favicon: "/my-custom-favicon.png", title: "My Docs", },})Dark/Light Image Variants
Section titled “Dark/Light Image Variants”Use separate images for each theme:
hero: image: dark: ../../assets/logo-dark.png light: ../../assets/logo-light.png alt: Project logoCustom Hero Override
Section titled “Custom Hero Override”If you need a completely custom hero, override it in your Starlight config. The theme will not replace it:
defineNorthwesternConfig({ starlight: { components: { Hero: "./src/components/MyHero.astro", }, title: "My Docs", },})Component Overrides
Section titled “Component Overrides”The theme overrides three Starlight components by default:
All three respect existing overrides. If you set Hero, EditLink, or ThemeSelect in your Starlight components config, the theme keeps your version.
Mermaid Diagrams
Section titled “Mermaid Diagrams”Mermaid support is opt-in. When installed, the theme applies Northwestern colors to all diagram types and adds a fullscreen viewer with pan/zoom, SVG download, source copying, and touch support.
To customize the Mermaid integration (toolbar, theme overrides):
defineNorthwesternConfig({ starlight: { title: "My Docs" }, mermaid: { toolbar: false, mermaidConfig: { themeVariables: { fontSize: "16px" }, }, },})Open Graph Images
Section titled “Open Graph Images”Each page gets a 1200x630 PNG at build time: favicon logo, page title, and description on Northwestern purple with a light purple accent border. Set site in your config for absolute URLs. See Getting Started for setup.
To disable OG images:
defineNorthwesternConfig({ starlight: { title: "My Docs" }, theme: { ogImage: false },})Expressive Code
Section titled “Expressive Code”With defineNorthwesternConfig, the theme configures GitHub syntax highlighting (github-dark / github-light) and the line-numbers plugin.
Use showLineNumbers on individual code blocks:
```ts showLineNumbers title="example.ts"const x = 1;```Overriding Themes
Section titled “Overriding Themes”Pass expressiveCode in your starlight config to replace the defaults. Properties you set override the theme’s; pluginLineNumbers and defaultProps are preserved.
defineNorthwesternConfig({ starlight: { title: "My Docs", expressiveCode: { themes: ["dracula", "github-light"], }, },})Manual Setup
Section titled “Manual Setup”If you use northwesternTheme() directly instead of defineNorthwesternConfig, line numbers require an ec.config.mjs at your project root:
import { defineEcConfig } from "@astrojs/starlight/expressive-code";import { northwesternExpressiveCode } from "@nu-appdev/northwestern-starlight-theme/expressive-code";
export default defineEcConfig(northwesternExpressiveCode());Integration Escape Hatch
Section titled “Integration Escape Hatch”If you need to add integrations before or after the managed ones, use the integrations key:
import sentry from "@sentry/astro";
defineNorthwesternConfig({ starlight: { title: "My Docs" }, integrations: { before: [], // before mermaid + starlight after: [sentry()], // after starlight },})Custom CSS
Section titled “Custom CSS”The theme loads its CSS before your project’s customCss, so you can override any token or style in your own CSS files.
defineNorthwesternConfig({ starlight: { title: "My Docs", customCss: ["./src/styles/overrides.css"], },})Available CSS Variables
Section titled “Available CSS Variables”The theme defines Northwestern design tokens as CSS custom properties. You can reference or override these in your own styles:
Purple Scale
Section titled “Purple Scale”See src/styles/variables.css in the theme package for the full token list.