Skip to content

Commit

Permalink
Merge pull request #5 from ahmic/theme-fix
Browse files Browse the repository at this point in the history
fix theme mode
  • Loading branch information
murdercode authored Jan 24, 2023
2 parents 72ef745 + a9ffdfe commit ad48aa8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,29 @@ export default {
},
created() {
this.setDarkMode();
this.setEditorTheme();
},
methods: {
setDarkMode() {
setEditorTheme() {
const selectedNovaTheme = localStorage.novaTheme;
if (typeof selectedNovaTheme !== 'undefined') {
if (selectedNovaTheme == 'system') {
this.setSystemMode();
} else if (selectedNovaTheme == 'dark') {
this.field.options.init.skin = 'oxide-dark';
this.field.options.init.content_css = 'dark';
} else {
this.field.options.init.skin = 'oxide';
this.field.options.init.content_css = 'default';
}
} else {
this.setSystemMode();
}
},
setSystemMode() {
this.field.options.init.skin =
window.matchMedia("(prefers-color-scheme: dark)").matches ||
document.querySelector("html").classList.contains("dark")
Expand Down

0 comments on commit ad48aa8

Please sign in to comment.