forked from javalsai/website
dark/light mode toggle
This commit is contained in:
parent
cb7060b5f2
commit
e1ccbf205f
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 |
@ -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>
|
||||
|
@ -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>
|
||||
|
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