Make darkmode the default
This commit is contained in:
parent
65dd6eec72
commit
87f6f6a461
2 changed files with 5 additions and 5 deletions
|
@ -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>
|
||||
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue