Skip to content

Commit

Permalink
Fix theme (alshedivat#697)
Browse files Browse the repository at this point in the history
* fix theme

* fix theme

Co-authored-by: rohandebsarkar <rohandebsarkar@gmail.com>
  • Loading branch information
2 people authored and horaciochacon committed Feb 28, 2023
1 parent a7183c4 commit 9159bc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ let transTheme = () => {


let initTheme = (theme) => {
if (theme == null) {
if (theme == null || theme == 'null') {
const userPref = window.matchMedia;
if (userPref && userPref('(prefers-color-scheme: dark)').matches) {
theme = 'dark';
}
}

setTheme(theme);
}

Expand Down

0 comments on commit 9159bc3

Please sign in to comment.