From 545df68251c1ad6eac65ab8ed4f2d49dfa35306a Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 4 Dec 2024 22:20:08 -0500 Subject: [PATCH] Add nuxt plugin to address 'stuck' dark color mode. --- website/plugins/colorMode.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 website/plugins/colorMode.ts diff --git a/website/plugins/colorMode.ts b/website/plugins/colorMode.ts new file mode 100644 index 000000000..9f797d945 --- /dev/null +++ b/website/plugins/colorMode.ts @@ -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"; + }); +});