diff --git a/arches/app/media/js/utils/create-vue-application.js b/arches/app/media/js/utils/create-vue-application.js index 2f1620adc4..d51990ce1b 100644 --- a/arches/app/media/js/utils/create-vue-application.js +++ b/arches/app/media/js/utils/create-vue-application.js @@ -13,7 +13,7 @@ import { createGettext } from "vue3-gettext"; import arches from 'arches'; import { DEFAULT_THEME } from "@/arches/themes/default.ts"; -export default async function createVueApplication(vueComponent, themeConfiguration) { +export default async function createVueApplication(vueComponent, themeConfiguration = DEFAULT_THEME) { /** * This wrapper allows us to maintain a level of control inside arches-core * over Vue apps. For instance this allows us to abstract i18n setup/config @@ -40,8 +40,19 @@ export default async function createVueApplication(vueComponent, themeConfigurat }); const app = createApp(vueComponent); + const darkModeClass = themeConfiguration.theme.options.darkModeSelector.substring(1); + const darkModeStorageKey = `arches.${darkModeClass}`; - app.use(PrimeVue, themeConfiguration || DEFAULT_THEME); + const darkModeToggleState = localStorage.getItem(darkModeStorageKey); + if ( + darkModeToggleState === "true" || + (darkModeToggleState === null && + window.matchMedia("(prefers-color-scheme: dark)").matches) + ) { + document.documentElement.classList.add(darkModeClass); + } + + app.use(PrimeVue, themeConfiguration); app.use(gettext); app.use(ConfirmationService); app.use(DialogService); diff --git a/arches/app/templates/base-root.htm b/arches/app/templates/base-root.htm index b5735d4f99..0413379c6b 100644 --- a/arches/app/templates/base-root.htm +++ b/arches/app/templates/base-root.htm @@ -35,16 +35,6 @@ gtag('config', '{{app_settings.GOOGLE_ANALYTICS_TRACKING_ID}}'); {% endif %} - {% block title %}{% endblock title %}