Fixed dark theme not applying on the first time (#273)

Reviewed-on: #273
Reviewed-by: Mikolaj Widla <widlam@noreply.example.com>
Co-authored-by: Adam Bem <adam.bem@zoho.eu>
Co-committed-by: Adam Bem <adam.bem@zoho.eu>
This commit is contained in:
2023-12-05 10:47:44 +01:00
committed by Adam Bem
parent ebb6730a1b
commit aad0d068d3
2 changed files with 36 additions and 19 deletions

View File

@@ -18,7 +18,10 @@ function changeLogoForTheme(){
}
function isDarkModeSet(){
return localStorage.theme == "dark";
if (localStorage.theme)
return localStorage.theme == "dark";
else
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
}
function changeTheme(theme:string){