UX: Update header background color in mobile app webview

Sends the updated value when switching color schemes.
This commit is contained in:
Penar Musaraj 2020-08-07 16:13:22 -04:00
parent 89209985c8
commit 31e9e0c41b
No known key found for this signature in database
GPG Key ID: E390435D881FF0F7

View File

@ -8,6 +8,13 @@ export default {
initialize() { initialize() {
if (isAppWebview()) { if (isAppWebview()) {
window
.matchMedia("(prefers-color-scheme: dark)")
.addListener(this.updateAppBackground);
this.updateAppBackground();
}
},
updateAppBackground() {
later(() => { later(() => {
const header = document.querySelectorAll(".d-header")[0]; const header = document.querySelectorAll(".d-header")[0];
if (header) { if (header) {
@ -16,5 +23,4 @@ export default {
} }
}, 500); }, 500);
} }
}
}; };