Skip to content

Commit

Permalink
Avoid flash on pageload for System and Dark+ themes (#4488)
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenRBS authored and mattgodbolt committed Jan 24, 2023
1 parent 723e651 commit 6ab90c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion views/_layout.pug
Expand Up @@ -31,7 +31,8 @@ html(lang="en")
| (function () {
| try {
| var settings = window.localStorage.getItem("!{localStoragePrefix}settings") || '{}';
| var theme = JSON.parse(settings).theme || 'default';
| var theme = JSON.parse(settings).theme;
| if (theme !== 'default') theme = 'dark';
| document.documentElement.setAttribute('data-theme', theme);
| } catch (e) {
| document.documentElement.setAttribute('data-theme', 'default');
Expand Down

0 comments on commit 6ab90c1

Please sign in to comment.