forked from cerc-io/cosmos-explorer
feat: daisyui theme toggle
This commit is contained in:
parent
b6a4b9e362
commit
dbddd6beb6
@ -29,10 +29,12 @@ const changeMode = (val: 'dark' | 'light' | 'system') => {
|
|||||||
if (value === 'dark') {
|
if (value === 'dark') {
|
||||||
document.documentElement.classList.add('dark');
|
document.documentElement.classList.add('dark');
|
||||||
document.documentElement.classList.remove('light');
|
document.documentElement.classList.remove('light');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.classList.add('light');
|
document.documentElement.classList.add('light');
|
||||||
document.documentElement.classList.remove('dark');
|
document.documentElement.classList.remove('dark');
|
||||||
}
|
}
|
||||||
|
document.documentElement.setAttribute("data-theme", value);
|
||||||
};
|
};
|
||||||
// Update icon if theme is changed from other sources
|
// Update icon if theme is changed from other sources
|
||||||
watch(theme, (val: 'dark' | 'light' | 'system') => {
|
watch(theme, (val: 'dark' | 'light' | 'system') => {
|
||||||
|
@ -20,6 +20,6 @@ const themes: ThemeSwitcherTheme[] = [
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<NewThemeSwitcher :themes="themes"/>
|
<NewThemeSwitcher :themes="themes"/>
|
||||||
<ThemeSwitcher :themes="themes" />
|
<!-- <ThemeSwitcher :themes="themes" /> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user