1
0
forked from javalsai/website

dark/light mode toggle

This commit is contained in:
deadvey 2024-10-08 23:11:49 +01:00
parent cb7060b5f2
commit e1ccbf205f
7 changed files with 38 additions and 9 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
Javalsai's website https://javalsai.dynv6.net/

0
README.md~ Normal file
View File

BIN
assets/moon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
assets/sun.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,10 +1,17 @@
<header>
<nav>
<ul class="row-ul">
<li><a href="/">home</a></li>
<li><a href="https://git.javalsai.dynv6.net/">gitea</a></li>
<li><a href="/tools">tools</a></li>
<li><a href="/notes">notes</a></li>
</ul>
</nav>
<nav>
<ul class="row-ul">
<li><a href="/">home</a></li>
<li><a href="https://git.javalsai.dynv6.net/">gitea</a></li>
<li><a href="/tools">tools</a></li>
<li><a href="/notes">notes</a></li>
<button class="theme-toggle-button" onclick="light_mode()"><img class="theme-toggle-image" height="12px" margin="0px" /></button>
</ul>
</nav>
<script>
function light_mode() {
var element = document.body;
element.classList.toggle("light-mode");
}
</script>
</header>

View File

@ -27,7 +27,7 @@
</head>
<body class="flex column">
<!--# include virtual="/components/header.html" -->
<!--# include virtual="/components/header.html" -->
<main>
<div class="intro-container flex row wrappable">
<div>
@ -96,6 +96,7 @@
and no, no <i>light</i> mode, I have enough with this
</p>
</footer>
</body>
</html>

View File

@ -21,6 +21,26 @@ body {
color: var(--text);
caret-color: var(--primary);
}
.light-mode {
background-color: white;
color: black;
.theme-toggle-image {
content:url("/assets/moon.png");
}
button {
background-color: white;
border: 0px;
margin: 0px
}
}
.theme-toggle-image {
content:url("/assets/sun.png");
}
button {
background-color: black;
border: 0px;
margin: 0px
}
*, *::before, *::after {
transition: all .3s ease-out;