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"
|
||||
@navbar-toggle="showMenu = !showMenu"
|
||||
>
|
||||
<DarkMode @updated="isDark = $event" />
|
||||
<DarkMode :isDark="this.isDark" @updated="isDark = $event" />
|
||||
|
||||
<LayoutToggle
|
||||
@updated="vlayout = $event"
|
||||
@ -159,6 +159,8 @@ export default {
|
||||
}
|
||||
this.config = merge(defaults, config);
|
||||
this.services = this.config.services;
|
||||
this.isDark = this.config.theme_use_dark;
|
||||
this.vlayout = this.config.vlayout;
|
||||
document.title =
|
||||
this.config.documentTitle ||
|
||||
`${this.config.title} | ${this.config.subtitle}`;
|
||||
|
@ -11,23 +11,21 @@
|
||||
<script>
|
||||
export default {
|
||||
name: "Darkmode",
|
||||
data: function () {
|
||||
return {
|
||||
isDark: null,
|
||||
};
|
||||
},
|
||||
props: ["isDark"],
|
||||
created: function () {
|
||||
this.isDark =
|
||||
var isDark =
|
||||
"overrideDark" in localStorage
|
||||
? JSON.parse(localStorage.overrideDark)
|
||||
: matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
this.$emit("updated", this.isDark);
|
||||
: this.isDark === null
|
||||
? matchMedia("(prefers-color-scheme: dark)").matches
|
||||
: this.isDark;
|
||||
this.$emit("updated", isDark);
|
||||
},
|
||||
methods: {
|
||||
toggleTheme: function () {
|
||||
this.isDark = !this.isDark;
|
||||
localStorage.overrideDark = this.isDark;
|
||||
this.$emit("updated", this.isDark);
|
||||
var isDark = !this.isDark;
|
||||
localStorage.overrideDark = isDark;
|
||||
this.$emit("updated", isDark);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user