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

View file

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