Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make updateTheme function name static #65

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 19 additions & 74 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .pnp.loader.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
440 changes: 220 additions & 220 deletions .yarn/releases/yarn-3.6.0.cjs → .yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarnPath: .yarn/releases/yarn-3.6.0.cjs
yarnPath: .yarn/releases/yarn-3.6.3.cjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@
]
},
"browserslist": "defaults",
"packageManager": "[email protected].0"
"packageManager": "[email protected].3"
}
18 changes: 9 additions & 9 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,28 @@
/>
<!-- Light/dark theme -->
<script>
function isDarkTheme() {
window.isDarkTheme = function () {
const theme = localStorage.getItem("theme");
return (
(theme && theme === "dark") ||
(!theme &&
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches)
);
}
function updateTheme() {
if (isDarkTheme()) {
};
window.updateTheme = function () {
if (window.isDarkTheme()) {
document.documentElement.setAttribute("data-theme", "dark");
} else {
document.documentElement.setAttribute("data-theme", "light");
}
}
};
if (window.matchMedia) {
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", updateTheme);
.addEventListener("change", window.updateTheme);
}
updateTheme();
window.updateTheme();
</script>
<!-- Google tag (gtag.js) -->
<script
Expand All @@ -101,13 +101,13 @@
<div class="dark-light-theme-selector-container">
<span
class="material-icons-outlined light-theme-selector"
onclick="localStorage.setItem('theme', 'dark'); updateTheme();"
onclick="localStorage.setItem('theme', 'dark'); window.updateTheme();"
>
light_mode
</span>
<span
class="material-icons-outlined dark-theme-selector"
onclick="localStorage.setItem('theme', 'light'); updateTheme();"
onclick="localStorage.setItem('theme', 'light'); window.updateTheme();"
>
dark_mode
</span>
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2145,9 +2145,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001349, caniuse-lite@npm:^1.0.30001400":
version: 1.0.30001445
resolution: "caniuse-lite@npm:1.0.30001445"
checksum: f98ca67829c3c52af5af0a62b8510432b2ad9594437d24ad460a6eb1a23d93e7a31631b1f550fbbe482ad05c467aa00da710a41699eb13d1f246d7db4147ab79
version: 1.0.30001523
resolution: "caniuse-lite@npm:1.0.30001523"
checksum: 3a007dc8147d4b5a6c22661d424e6d4e4e9595d0dcb279d25b93161cc7d54363eb12d053f40a186ba7e42a8bc4f59e6e121474b7aa339bf7ec200258400d39bc
languageName: node
linkType: hard

Expand Down
Loading