Renamed variable to make more sense
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
darkmode: this.supported()
|
darkmode: this.systemDarkModeEnabled()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -16,7 +16,7 @@ export default {
|
|||||||
this.darkmode = !this.darkmode;
|
this.darkmode = !this.darkmode;
|
||||||
document.body.className = this.darkmode ? "dark" : "light";
|
document.body.className = this.darkmode ? "dark" : "light";
|
||||||
},
|
},
|
||||||
supported() {
|
systemDarkModeEnabled() {
|
||||||
const computedStyle = window.getComputedStyle(document.body);
|
const computedStyle = window.getComputedStyle(document.body);
|
||||||
if (computedStyle["colorScheme"] != null) {
|
if (computedStyle["colorScheme"] != null) {
|
||||||
return computedStyle.colorScheme.includes("dark");
|
return computedStyle.colorScheme.includes("dark");
|
||||||
|
|||||||
Reference in New Issue
Block a user