Skip to content
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
1 change: 1 addition & 0 deletions src/demo/css/toggle-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ a.darkmode {
0 0 3px rgb(0 0 0 / 12%),
0 1px 2px rgb(0 0 0 / 24%);
transition: 0.2s ease-in box-shadow;
text-decoration: none;
}

a.darkmode:hover {
Expand Down
9 changes: 7 additions & 2 deletions src/demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function gtag() {
gtag('config', 'G-48CYVH0XEF');
</script>
<title>GitHub Readme Streak Stats Demo</title>
<link href="https://css-gg-cdn.pages.dev/css" rel="stylesheet">
<link rel="stylesheet" href="./css/style.css?v=<?= filemtime("./css/style.css") ?>">
<link rel="stylesheet" href="./css/toggle-dark.css?v=<?= filemtime("./css/toggle-dark.css") ?>">

Expand Down Expand Up @@ -281,7 +280,13 @@ function gtag() {
</div>

<a href="javascript:toggleTheme()" class="darkmode" title="toggle dark mode">
<i class="<?php echo $darkmode === "on" ? "gg-sun" : "gg-moon"; ?>"></i>
<span id="darkmode-icon">
<?php if ($darkmode === "on"): ?>
🌞
<?php else: ?>
🌙
<?php endif; ?>
</span>
</a>
</body>

Expand Down
4 changes: 2 additions & 2 deletions src/demo/js/toggle-dark.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getCookie(name) {
* Turn on dark mode
*/
function darkmode() {
document.querySelector(".darkmode i").className = "gg-sun";
document.querySelector("#darkmode-icon").innerText = "🌞";
setCookie("darkmode", "on", 9999);
document.body.setAttribute("data-theme", "dark");
}
Expand All @@ -48,7 +48,7 @@ function darkmode() {
* Turn on light mode
*/
function lightmode() {
document.querySelector(".darkmode i").className = "gg-moon";
document.querySelector("#darkmode-icon").innerText = "🌙";
setCookie("darkmode", "off", 9999);
document.body.removeAttribute("data-theme");
}
Expand Down