mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-10 10:18:23 +00:00
Add auto theme option.
This commit is contained in:
parent
b5a0ca8324
commit
9b79a9c848
@ -34,6 +34,7 @@
|
|||||||
<b>Theme</b>
|
<b>Theme</b>
|
||||||
<br />
|
<br />
|
||||||
<select class="uk-select uk-width-auto" v-model="selectedTheme" @change="onChange($event)">
|
<select class="uk-select uk-width-auto" v-model="selectedTheme" @change="onChange($event)">
|
||||||
|
<option value="auto">Auto</option>
|
||||||
<option value="dark">Dark</option>
|
<option value="dark">Dark</option>
|
||||||
<option value="light">Light</option>
|
<option value="light">Light</option>
|
||||||
</select>
|
</select>
|
||||||
|
17
src/main.js
17
src/main.js
@ -129,22 +129,29 @@ const mixin = {
|
|||||||
apiUrl() {
|
apiUrl() {
|
||||||
return this.getPreferenceString("instance", "https://pipedapi.kavin.rocks");
|
return this.getPreferenceString("instance", "https://pipedapi.kavin.rocks");
|
||||||
},
|
},
|
||||||
|
getEffectiveTheme() {
|
||||||
|
var theme = this.getPreferenceString("theme", "dark");
|
||||||
|
if (theme === "auto")
|
||||||
|
theme =
|
||||||
|
window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||||
|
return theme;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
backgroundColor() {
|
backgroundColor() {
|
||||||
return this.getPreferenceString("theme", "dark") === "light" ? "#fff" : "#0b0e0f";
|
return this.getEffectiveTheme() === "light" ? "#fff" : "#0b0e0f";
|
||||||
},
|
},
|
||||||
secondaryBackgroundColor() {
|
secondaryBackgroundColor() {
|
||||||
return this.getPreferenceString("theme", "dark") === "light" ? "#e5e5e5" : "#242727";
|
return this.getEffectiveTheme() === "light" ? "#e5e5e5" : "#242727";
|
||||||
},
|
},
|
||||||
foregroundColor() {
|
foregroundColor() {
|
||||||
return this.getPreferenceString("theme", "dark") === "light" ? "#15191a" : "#0b0e0f";
|
return this.getEffectiveTheme() === "light" ? "#15191a" : "#0b0e0f";
|
||||||
},
|
},
|
||||||
secondaryForegroundColor() {
|
secondaryForegroundColor() {
|
||||||
return this.getPreferenceString("theme", "dark") === "light" ? "#666" : "#393d3d";
|
return this.getEffectiveTheme() === "light" ? "#666" : "#393d3d";
|
||||||
},
|
},
|
||||||
darkMode() {
|
darkMode() {
|
||||||
return this.getPreferenceString("theme", "dark") !== "light";
|
return this.getEffectiveTheme() !== "light";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user