Astro Starlightでフォントを指定する
Starlightではフォントの指定方法がいくつかあるが、フォントファミリーを指定する場合は、カスタムのCSSファイルを作成して既定の値を上書きする。
ドキュメントに従う。まず src/styles/custom.css ファイルを作成し、 --sl-font を上書きする。
1
2
3
4
:root {
--sl-font: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Hiragino Kaku Gothic Pro',
'メイリオ', Meiryo, Verdana, 'MS Pゴシック', sans-serif;
}
次いで、CSSファイルを読み込むように astro.config.mjs に記述する。
1
2
3
4
5
6
7
8
9
export default defineConfig({
integrations: [
starlight({
customCss: [
'./src/styles/custom.css',
],
}),
],
});
This post is licensed under CC BY 4.0 by the author.