Skip to content
Discussion options

You must be logged in to vote

Using custom fonts with Astro 6 in Starlight requires a bit of setup at the moment.

  1. First, you would need to configure a custom font as documented in Astro Docs, for example using the "Press Start 2P" font from Fontsource:

    // astro.config.mjs
    import { defineConfig, fontProviders } from "astro/config";
    
    export default defineConfig({
      fonts: [
        {
          provider: fontProviders.fontsource(),
          name: "Press Start 2P",
          cssVariable: "--font-press-start-2p",
        },
      ],
    });
  2. Then, you would need to add the font to Starlight page head with an identifying CSS variable. This can be achieved by using Starlight component overrides which also allows re-using built-in Starlight components:

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Keshav-writes-code
Comment options

@Keshav-writes-code
Comment options

Answer selected by Keshav-writes-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants