mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 10:07:21 +02:00
Update theme on system color mode change (#3296)
Currently, when theme `auto` is set and the system theme changes, users need to reload the site themselves. This PR adds an even listener which listens for such changes and reloads the theme automatically in the background. --------- Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
parent
3415e2bae7
commit
da4bd8b97d
@ -1,7 +1,11 @@
|
||||
import { useColorMode } from '@vueuse/core';
|
||||
import { watch } from 'vue';
|
||||
|
||||
const { store: storeTheme, state: resolvedTheme } = useColorMode({
|
||||
const {
|
||||
store: storeTheme,
|
||||
state: resolvedTheme,
|
||||
system: systemTheme,
|
||||
} = useColorMode({
|
||||
storageKey: 'woodpecker:theme',
|
||||
});
|
||||
|
||||
@ -19,9 +23,7 @@ function updateTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
watch(storeTheme, updateTheme);
|
||||
|
||||
updateTheme();
|
||||
watch([storeTheme, systemTheme], updateTheme, { immediate: true });
|
||||
|
||||
export function useTheme() {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user