Skip to content

Commit

Permalink
preload background color [#10 issue]
Browse files Browse the repository at this point in the history
  • Loading branch information
kholmogorov27 committed Mar 13, 2023
1 parent f1d83df commit da62801
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/public/font.css">
<title>Chevron</title>

<!-- coloration -->
<script>
const settings = JSON.parse(localStorage.getItem('settings'))
if (settings) {
const colorScheme = settings.appearance.colorScheme === 'auto'
? window.matchMedia("(prefers-color-scheme: dark)").matches
? 'dark'
: 'light'
: settings.appearance.colorScheme

document.documentElement.style.backgroundColor = settings.appearance.themes[settings.appearance.activeTheme][colorScheme].background
}
</script>
<!-- -->

</head>
<body>
<div id="root"></div>
Expand Down

0 comments on commit da62801

Please sign in to comment.