You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1db298d
Browse filesBrowse the repository at this point in the historyBrowse files
feat(react): high-contrast syntax highlighting with light/dark pair (#162)
* feat(react): high-contrast syntax highlighting with light/dark pair
The previous single Vitesse Dark theme was the same in both modes
and lacked contrast. Switch to GitHub Light/Dark as the default pair
and make the theme selectable at the component level.
- `lib/shiki.ts`: export `SupportedTheme`, `DEFAULT_LIGHT_THEME`,
`DEFAULT_DARK_THEME`, and a `ShikiThemeProp` that accepts either a
single theme or a `{ light, dark }` pair. Add `useIsDark` and
`useResolvedShikiTheme` hooks so components can react to the
system color-scheme. Load both GitHub themes up-front.
- `CodeBlock` and `ExpandableCodeBlock`: accept an optional `theme`
prop and pass it through the tokenization hooks.
- Streamdown plugin: key its cache per active theme so switching
color schemes doesn't serve stale tokens.
* refactor(react): extract useIsDark hook from shiki module
Move useIsDark into its own hook file so it can be reused outside
of syntax highlighting. Also remove unused THEME export and
vitesse-dark theme.
---------
Co-authored-by: Rhys Sullivan <39114868+RhysSullivan@users.noreply.github.com>
0 commit comments