Linting
This commit is contained in:
@@ -1,41 +1,36 @@
|
||||
<template>
|
||||
|
||||
<div class="darkToggle">
|
||||
<span @click="toggleDarkmode()">{{ darkmodeToggleIcon }}</span>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
darkmode: this.supported
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
toggleDarkmode() {
|
||||
this.darkmode = !this.darkmode;
|
||||
document.body.className = this.darkmode ? 'dark' : 'light'
|
||||
document.body.className = this.darkmode ? "dark" : "light";
|
||||
},
|
||||
supported() {
|
||||
const computedStyle = window.getComputedStyle(document.body)
|
||||
if (computedStyle['colorScheme'] != null)
|
||||
return computedStyle.colorScheme.includes('dark')
|
||||
return false
|
||||
const computedStyle = window.getComputedStyle(document.body);
|
||||
if (computedStyle["colorScheme"] != null)
|
||||
return computedStyle.colorScheme.includes("dark");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
darkmodeToggleIcon() {
|
||||
return this.darkmode ? '🌝' : '🌚'
|
||||
return this.darkmode ? "🌝" : "🌚";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.darkToggle {
|
||||
height: 25px;
|
||||
@@ -54,4 +49,4 @@ export default {
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user