Skip to content

Commit

Permalink
[system][InitColorSchemeScript] Use let/const instead of var (#43468
Browse files Browse the repository at this point in the history
)

Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
Co-authored-by: Siriwat K <siriwatkunaporn@gmail.com>
Co-authored-by: ZeeshanTamboli <zeeshan.tamboli@gmail.com>
  • Loading branch information
3 people committed Aug 30, 2024
1 parent b662c85 commit aedf366
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ export default function InitColorSchemeScript(options?: InitColorSchemeScriptPro
dangerouslySetInnerHTML={{
__html: `(function() {
try {
var mode = localStorage.getItem('${modeStorageKey}') || 'system';
var colorScheme = '';
var dark = localStorage.getItem('${colorSchemeStorageKey}-dark') || '${defaultDarkColorScheme}';
var light = localStorage.getItem('${colorSchemeStorageKey}-light') || '${defaultLightColorScheme}';
let colorScheme = '';
const mode = localStorage.getItem('${modeStorageKey}') || 'system';
const dark = localStorage.getItem('${colorSchemeStorageKey}-dark') || '${defaultDarkColorScheme}';
const light = localStorage.getItem('${colorSchemeStorageKey}-light') || '${defaultLightColorScheme}';
if (mode === 'system') {
// handle system mode
var mql = window.matchMedia('(prefers-color-scheme: dark)');
const mql = window.matchMedia('(prefers-color-scheme: dark)');
if (mql.matches) {
colorScheme = dark
} else {
Expand Down

0 comments on commit aedf366

Please sign in to comment.