diff --git a/src/App.vue b/src/App.vue index 4ffc5828..f34d10f2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,6 +4,7 @@ import { NGlobalStyle, NMessageProvider, NNotificationProvider, darkTheme } from import { darkThemeOverrides, lightThemeOverrides } from './themes'; import { layouts } from './layouts'; import { useStyleStore } from './stores/style.store'; +import { useAppTheme } from './ui/theme/themes'; const route = useRoute(); const layout = computed(() => route?.meta?.layout ?? layouts.base); @@ -14,6 +15,21 @@ const themeOverrides = computed(() => (styleStore.isDarkTheme ? darkThemeOverrid const { locale } = useI18n(); +const colorPalette = useAppTheme(); + +// Create CSS custom properties for the color palette +const cssVars = computed(() => ({ + '--loading-background-color': colorPalette.value.loading_background, +})); + +// Apply CSS variables to the document root +watchEffect(() => { + const root = document.documentElement; + Object.entries(cssVars.value).forEach(([key, value]) => { + root.style.setProperty(key, value); + }); +}); + syncRef( locale, useStorage('locale', locale), @@ -25,9 +41,11 @@ syncRef( - - - +
+ + + +
@@ -51,15 +69,16 @@ html { } body .vld-container { - position:absolute; - left:0; - top:0; + position: absolute; + left: 0; + top: 0; width: 100%; height: 100vh; - background-color: #101014; + background-color: var(--loading-background-color); z-index: 9999; text-align: center; } + body .vld-container .vl-overlay.vl-active { margin-top: 15%; } diff --git a/src/router.ts b/src/router.ts index c2a5e56e..26496200 100644 --- a/src/router.ts +++ b/src/router.ts @@ -6,9 +6,9 @@ import NotFound from './pages/404.page.vue'; import { tools } from './tools'; import { config } from './config'; import { routes as demoRoutes } from './ui/demo/demo.routes'; +import { useAppTheme } from './ui/theme/themes'; const $loading = useLoading(); - const toolsRoutes = tools.map(({ path, name, component, ...config }) => ({ path, name, @@ -46,9 +46,9 @@ let loader: ActiveLoader | null = null; router.beforeEach((to, from) => { // Only show loading for actual route changes, not just query param changes if (to.path !== from.path) { + const theme = useAppTheme(); loader = $loading?.show({ - color: '#fff', - backgroundColor: '#292929', + color: theme.value.primary.color, }); } }); diff --git a/src/ui/theme/themes.ts b/src/ui/theme/themes.ts index 2c330b03..717a4a49 100644 --- a/src/ui/theme/themes.ts +++ b/src/ui/theme/themes.ts @@ -36,6 +36,7 @@ export const { themes: appThemes, useTheme: useAppTheme } = defineThemes({ colorPressed: '#ab1f3f', colorFaded: '#d030502a', }, + loading_background: '#f1f5f9', }, dark: { background: '#1e1e1e', @@ -72,5 +73,6 @@ export const { themes: appThemes, useTheme: useAppTheme } = defineThemes({ colorPressed: '#e57272', colorFaded: '#e8808029', }, + loading_background: '#1c1c1c', }, }); diff --git a/vite.config.ts b/vite.config.ts index e58bfe99..b0c25b68 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -108,7 +108,7 @@ export default defineConfig({ wasm(), splashScreen({ logoSrc: 'logo.svg', - splashBg: '#292929', + splashBg: '#383838', }), ], base: baseUrl,