forked from javalsai/website
dark/light mode toggle
This commit is contained in:
parent
cb7060b5f2
commit
4f6cdf31d4
0
README.md~
Normal file
0
README.md~
Normal file
BIN
assets/moon.png
Normal file
BIN
assets/moon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
assets/sun.png
Normal file
BIN
assets/sun.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -5,6 +5,13 @@
|
||||
<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>
|
||||
|
@ -96,6 +96,7 @@
|
||||
and no, no <i>light</i> mode, I have enough with this
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
20
style.css
20
style.css
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user