Skip to content

Commit

Permalink
core: frontend: Add dark-mode toggle switch
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl authored and patrickelectric committed Oct 28, 2021
1 parent 72256d5 commit 81427ab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/frontend/src/components/app/SettingsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
</v-icon>
Reset Settings
</v-btn>
<v-switch
v-model="dark_mode"
label="Dark mode"
/>
</v-row>
</v-container>
</v-card>
Expand Down Expand Up @@ -67,13 +71,20 @@ export default Vue.extend({
components: {
},
data() {
const system_dark_mode_state = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
return {
show_dialog: false,
show_reset_dialog: false,
dark_mode: system_dark_mode_state,
}
},
computed: {
},
watch: {
dark_mode(val: boolean): void {
this.$vuetify.theme.dark = val
},
},
methods: {
async reset_settings(): Promise<void> {
await back_axios({
Expand Down

0 comments on commit 81427ab

Please sign in to comment.