mirror of
https://github.com/taigrr/homer
synced 2025-01-18 04:53:12 -08:00
feat: adds support for theme_use_dark
This commit is contained in:
parent
1fc60ffe4f
commit
729d1b5309
@ -28,7 +28,7 @@
|
|||||||
:links="config.links"
|
:links="config.links"
|
||||||
@navbar-toggle="showMenu = !showMenu"
|
@navbar-toggle="showMenu = !showMenu"
|
||||||
>
|
>
|
||||||
<DarkMode @updated="isDark = $event" />
|
<DarkMode :isDark="this.isDark" @updated="isDark = $event" />
|
||||||
|
|
||||||
<LayoutToggle
|
<LayoutToggle
|
||||||
@updated="vlayout = $event"
|
@updated="vlayout = $event"
|
||||||
@ -159,6 +159,8 @@ export default {
|
|||||||
}
|
}
|
||||||
this.config = merge(defaults, config);
|
this.config = merge(defaults, config);
|
||||||
this.services = this.config.services;
|
this.services = this.config.services;
|
||||||
|
this.isDark = this.config.theme_use_dark;
|
||||||
|
this.vlayout = this.config.vlayout;
|
||||||
document.title =
|
document.title =
|
||||||
this.config.documentTitle ||
|
this.config.documentTitle ||
|
||||||
`${this.config.title} | ${this.config.subtitle}`;
|
`${this.config.title} | ${this.config.subtitle}`;
|
||||||
|
@ -11,23 +11,21 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "Darkmode",
|
name: "Darkmode",
|
||||||
data: function () {
|
props: ["isDark"],
|
||||||
return {
|
|
||||||
isDark: null,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created: function () {
|
created: function () {
|
||||||
this.isDark =
|
var isDark =
|
||||||
"overrideDark" in localStorage
|
"overrideDark" in localStorage
|
||||||
? JSON.parse(localStorage.overrideDark)
|
? JSON.parse(localStorage.overrideDark)
|
||||||
: matchMedia("(prefers-color-scheme: dark)").matches;
|
: this.isDark === null
|
||||||
this.$emit("updated", this.isDark);
|
? matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
|
: this.isDark;
|
||||||
|
this.$emit("updated", isDark);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleTheme: function () {
|
toggleTheme: function () {
|
||||||
this.isDark = !this.isDark;
|
var isDark = !this.isDark;
|
||||||
localStorage.overrideDark = this.isDark;
|
localStorage.overrideDark = isDark;
|
||||||
this.$emit("updated", this.isDark);
|
this.$emit("updated", isDark);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user