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 |
@ -1,10 +1,17 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav>
|
<nav>
|
||||||
<ul class="row-ul">
|
<ul class="row-ul">
|
||||||
<li><a href="/">home</a></li>
|
<li><a href="/">home</a></li>
|
||||||
<li><a href="https://git.javalsai.dynv6.net/">gitea</a></li>
|
<li><a href="https://git.javalsai.dynv6.net/">gitea</a></li>
|
||||||
<li><a href="/tools">tools</a></li>
|
<li><a href="/tools">tools</a></li>
|
||||||
<li><a href="/notes">notes</a></li>
|
<li><a href="/notes">notes</a></li>
|
||||||
</ul>
|
<button class="theme-toggle-button" onclick="light_mode()"><img class="theme-toggle-image" height="12px" margin="0px" /></button>
|
||||||
</nav>
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<script>
|
||||||
|
function light_mode() {
|
||||||
|
var element = document.body;
|
||||||
|
element.classList.toggle("light-mode");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</header>
|
</header>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="flex column">
|
<body class="flex column">
|
||||||
<!--# include virtual="/components/header.html" -->
|
<!--# include virtual="/components/header.html" -->
|
||||||
<main>
|
<main>
|
||||||
<div class="intro-container flex row wrappable">
|
<div class="intro-container flex row wrappable">
|
||||||
<div>
|
<div>
|
||||||
@ -96,6 +96,7 @@
|
|||||||
and no, no <i>light</i> mode, I have enough with this
|
and no, no <i>light</i> mode, I have enough with this
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
20
style.css
20
style.css
@ -21,6 +21,26 @@ body {
|
|||||||
color: var(--text);
|
color: var(--text);
|
||||||
caret-color: var(--primary);
|
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 {
|
*, *::before, *::after {
|
||||||
transition: all .3s ease-out;
|
transition: all .3s ease-out;
|
||||||
|
Loading…
Reference in New Issue
Block a user