Skip to content

Commit

Permalink
fix(theme): Remove light theme by overwriting ThemeProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurKnaus committed Nov 24, 2023
1 parent 5d1f136 commit b2ff7b0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/website/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default defineConfig({
components: {
Hero: './src/components/Hero.astro',
Header: './src/components/Header.astro',
ThemeProvider: './src/components/ThemeProvider.astro',
},

head: [
Expand Down Expand Up @@ -124,6 +125,10 @@ export default defineConfig({
},
},
],
expressiveCode: {
themes: ['starlight-dark'],
useStarlightUiThemeColors: true,
},
customCss: ['./src/tailwind.css', './src/theme.css'],
}),
tailwind({
Expand Down
14 changes: 14 additions & 0 deletions packages/website/src/components/ThemeProvider.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
// Override the default ThemeProvider to completely disable light theme.
---
{/* This is intentionally inlined to avoid FOUC. */}
<script is:inline>
window.StarlightThemeProvider = (() => {
document.documentElement.dataset.theme = 'dark';
return {
updatePickers(theme = storedTheme || 'auto') {
// Do nothing as we disable the pickers.
},
};
})();
</script>

0 comments on commit b2ff7b0

Please sign in to comment.