Fix theme (#697)

* fix theme

* fix theme

Co-authored-by: rohandebsarkar <rohandebsarkar@gmail.com>
This commit is contained in:
Rohan Deb Sarkar 2022-06-08 10:41:27 +05:30 committed by GitHub
parent f7274c0dab
commit 4e460ee494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,12 +50,13 @@ let transTheme = () => {
let initTheme = (theme) => { let initTheme = (theme) => {
if (theme == null) { if (theme == null || theme == 'null') {
const userPref = window.matchMedia; const userPref = window.matchMedia;
if (userPref && userPref('(prefers-color-scheme: dark)').matches) { if (userPref && userPref('(prefers-color-scheme: dark)').matches) {
theme = 'dark'; theme = 'dark';
} }
} }
setTheme(theme); setTheme(theme);
} }