Skip to content

Commit

Permalink
Improve theme query
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Dec 3, 2024
1 parent f42364d commit 18e73a1
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
import { ref } from "vue";
import { useGettext } from "vue3-gettext";
import { Theme } from "@primeuix/styled";
import ToggleButton from "primevue/togglebutton";
import { DEFAULT_THEME } from "@/arches/themes/default.ts";
const { $gettext } = useGettext();
const darkModeClass = DEFAULT_THEME.theme.options.darkModeSelector.substring(1);
const darkModeClass = Theme.options.darkModeSelector.substring(1);
const isDarkModeEnabled = ref(
document.documentElement.classList.contains(darkModeClass),
);
function toggleDarkMode() {
document.documentElement.classList.toggle(darkModeClass);
isDarkModeEnabled.value = !isDarkModeEnabled.value;
localStorage.setItem(darkModeClass, isDarkModeEnabled.value.toString());
localStorage.setItem(
`arches.${darkModeClass}`,
isDarkModeEnabled.value.toString(),
);
}
</script>

Expand Down

0 comments on commit 18e73a1

Please sign in to comment.