Skip to content

Commit

Permalink
Add nuxt plugin to address 'stuck' dark color mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Dec 5, 2024
1 parent 1f58fff commit 545df68
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions website/plugins/colorMode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Forces light color mode even if localStorage already contains saved preference.
// `colorMode.preference` setting from `nuxt.config.ts` is not enough in this case.
export default defineNuxtPlugin((nuxtApp) => {
const colorMode = useColorMode();
nuxtApp.hook("app:mounted", () => {
colorMode.preference = "light";
colorMode.value = "light";
});
});

0 comments on commit 545df68

Please sign in to comment.