Make darkmode the default

This commit is contained in:
Patrick Schwarzer 2025-05-10 01:45:49 +02:00
parent 65dd6eec72
commit 87f6f6a461
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@
<title>Tarions Portfolio</title>
<link rel="stylesheet" href="index.css">
</head>
<body class="light-mode">
<body>
<header>
<nav>
<div class="logo">
@ -28,7 +28,7 @@
<a href="#">Contact</a>
</li>
</ul>
<button id="dark-mode-toggle" class="dark-mode-toggle">☀️</button>
<button id="dark-mode-toggle" class="dark-mode-toggle">🌙</button>
</nav>
</header>

View file

@ -14,9 +14,9 @@ document.addEventListener("DOMContentLoaded", () => {
// Load Dark Mode preference from cache
const theme = localStorage.getItem("theme");
if (theme === "dark"){
body.classList.remove("light-mode");
darkModeButton.textContent = "🌙";
if (theme === "light"){
body.classList.add("light-mode");
darkModeButton.textContent = "☀️";
}
darkModeButton.addEventListener("click", () => {