Skip to content

Commit

Permalink
Fixed occasional flashing when toggling scheme (#1283)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonrietdijk authored Jun 13, 2023
1 parent 48e842d commit 569c715
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/app.js": "/app.js?id=c6187bff8d842d49dbb4d3de4b583600",
"/app.js": "/app.js?id=c6d58c1ba0a1e0ad976bd661884a1582",
"/app-dark.css": "/app-dark.css?id=15c72df05e2b1147fa3e4b0670cfb435",
"/app.css": "/app.css?id=4d6a1a7fe095eedc2cb2a4ce822ea8a5",
"/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f",
Expand Down
8 changes: 1 addition & 7 deletions resources/js/components/SchemeToggler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,14 @@
},
calculateScheme () {
const light = document.querySelector('link[data-scheme="light"]');
const dark = document.querySelector('link[data-scheme="dark"]');
if (this.scheme == 'system') {
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)');
light.disabled = prefersDarkMode.matches;
dark.disabled = ! prefersDarkMode.matches;
} else if (this.scheme == 'dark') {
light.disabled = true;
dark.disabled = false;
} else {
light.disabled = false;
dark.disabled = true;
dark.disabled = this.scheme != 'dark';
}
}
}
Expand Down

0 comments on commit 569c715

Please sign in to comment.