Getting Started
Install
Section titled “Install”npm install starlight-theme-large-print# optional: one CJK font packnpm install starlight-theme-large-print-font-noto-serif-sc # Simplified Chinesenpm install starlight-theme-large-print-font-noto-serif-tc # Traditional ChineseConfigure
Section titled “Configure”Add the plugin to your Starlight plugins array in astro.config.mjs:
import starlightThemeLargePrint from 'starlight-theme-large-print';
export default defineConfig({ integrations: [ starlight({ plugins: [ starlightThemeLargePrint({ font: 'noto-serif-sc', // 'noto-serif-sc' | 'noto-serif-tc' | false // baseFontSize: '17px', // lineHeight: 1.85, // warmDark: true, }), ], }), ],});Add the font-size control
Section titled “Add the font-size control”The theme does not auto-inject the A− A A+ control (auto-overriding a Starlight component would collide with other themes). Render it in your own Header override, next to <ThemeSelect />:
---import FontSizeControl from 'starlight-theme-large-print/components/FontSizeControl.astro';---
<FontSizeControl />Dropdown variant: FontSizeSelect
Section titled “Dropdown variant: FontSizeSelect”A dropdown (native <select>) variant showing the current step by name — same five steps, same persistence, so reader preferences carry over between the two. Step labels and the accessible name are props for localization:
---import FontSizeSelect from 'starlight-theme-large-print/components/FontSizeSelect.astro';---
<FontSizeSelect labels={['小', '稍小', '标准', '大', '特大']} ariaLabel="字号" />Both components may coexist on one page (they stay in sync via data-lp-step), though sites will typically pick one.
Per-locale fonts (i18n sites)
Section titled “Per-locale fonts (i18n sites)”font also accepts a map keyed by Starlight locale: each locale’s pages get their own pack, scoped via the <html lang> attribute. The root entry (if present) sets the site-wide default, exactly like the string form. This demo site uses it to serve SC on Simplified pages and TC on Traditional pages:
starlightThemeLargePrint({ font: { 'zh-cn': 'noto-serif-sc', 'zh-tw': 'noto-serif-tc' },}),Install every pack you reference; pages in locales without an entry fall back to the system serif stack.
Options
Section titled “Options”| Option | Default | Description |
|---|---|---|
font |
false |
'noto-serif-sc' | 'noto-serif-tc' | false | locale→pack map. Requires the matching font package(s). |
baseFontSize |
'17px' |
Base body font size; readers can override it with the font-size control. |
lineHeight |
1.85 |
Body line height. |
warmDark |
true |
Warm paper-tone dark mode background. |