mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-06 04:38:31 +00:00
Make mode setting code clearer
This should clear up some confusion with the way that I had implemented mode setting, making the code more readable.
This commit is contained in:
parent
90cd3571ae
commit
854e9f61c4
@ -38,12 +38,15 @@ function set_mode (bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_mode (mode) {
|
function update_mode (mode) {
|
||||||
set_mode(
|
if (mode == 'true' /* for backwards compatibility */ || mode == 'dark') {
|
||||||
mode == 'true' // for backwards compatibility
|
// If dark mode preference set
|
||||||
|| mode == 'dark'
|
set_mode(true);
|
||||||
|| (mode != 'light'
|
}
|
||||||
&& window.matchMedia('(prefers-color-scheme: dark)').matches)
|
else if (mode != 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||||
);
|
// If no preference set, but the browser tells us that the operating system has a dark theme
|
||||||
|
set_mode(true);
|
||||||
|
}
|
||||||
|
else set_mode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user