Skip to content

Commit

Permalink
changed theme.db to theme.name
Browse files Browse the repository at this point in the history
  • Loading branch information
novcmbro committed Jun 6, 2024
1 parent af4e2c0 commit e7aa1ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" class="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand Down
6 changes: 3 additions & 3 deletions src/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ const localStorageKey = "novcmbro_decoder_theme"
const rootElement = document.documentElement

const theme = {
name: () => localStorage.getItem(localStorageKey),
preferred: undefined,
db: () => localStorage.getItem(localStorageKey),
update: undefined,
init: undefined,
change: undefined
}

theme.preferred = () => prefersLightTheme.matches ? "light" : "dark"

theme.update = () => rootElement.className = theme.db()
theme.update = () => rootElement.className = theme.name()

theme.init = () => {
if (!theme.db()) {
if (!theme.name()) {
localStorage.setItem(localStorageKey, theme.preferred())
}

Expand Down

0 comments on commit e7aa1ae

Please sign in to comment.