mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Update header background color in mobile app webview
Sends the updated value when switching color schemes.
This commit is contained in:
parent
89209985c8
commit
31e9e0c41b
@ -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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user