Skip to content

Commit 55e0f23

Browse files
committed
Dark and Light mode
1 parent 7644f1f commit 55e0f23

File tree

2 files changed

+100
-1
lines changed

2 files changed

+100
-1
lines changed

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
<body>
1818
<nav class="navbar">
1919
<p>Chryz-Hub</p>
20+
<input type="checkbox" class="checkbox" id="chk" />
21+
<label class="label" for="chk">
22+
<i class="fas fa-moon"></i>
23+
<i class="fas fa-sun"></i>
24+
<div class="ball"></div>
25+
</label>
2026
</nav>
2127
<div class="container">
2228
<div class="row">
@@ -78,5 +84,11 @@
7884
<footer>
7985
<p class="footer-bottom">Made with ❤️ by <a href="https://github.com/chryz-hub">ChryzHub</a></p>
8086
</footer>
87+
<script>
88+
const chk = document.getElementById('chk');
89+
chk.addEventListener('change', () => {
90+
document.body.classList.toggle('dark');
91+
});
92+
</script>
8193
</body>
8294
</html>

style.css

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,95 @@
55
font-family: "Open Sans";
66
}
77

8+
.label {
9+
background-color: #111;
10+
border-radius: 50px;
11+
justify-content: space-between;
12+
position: relative;
13+
height: 26px;
14+
width: 50px;
15+
float: right;
16+
padding: 5px;
17+
align-items: center;
18+
display: flex;
19+
transform: scale(1.2);
20+
}
21+
22+
.checkbox {
23+
opacity: 0;
24+
position: absolute;
25+
}
26+
27+
.label .ball {
28+
background-color: #fff;
29+
border-radius: 50%;
30+
position: absolute;
31+
top: 2px;
32+
left: 2px;
33+
height: 22px;
34+
width: 22px;
35+
transition: transform 0.2s linear;
36+
}
37+
38+
.checkbox:checked + .label .ball {
39+
transform: translateX(22px);
40+
}
41+
42+
.fa-moon {
43+
color: #f1c40f;
44+
font-size: 15px;
45+
}
46+
47+
.fa-sun {
48+
color: #f39c12;
49+
padding-left:10px;
50+
font-size: 15px;
51+
}
52+
53+
854
body {
9-
background: white;
1055
width: 100%;
56+
margin: 0;
57+
background-color: #fafafa;
58+
height: 100%;
59+
transition: background 0.2s linear;
60+
}
61+
62+
body.dark {
63+
background: #292C35;
64+
}
65+
66+
body.dark nav{
67+
background: white;
68+
}
69+
70+
body.dark nav p{
71+
color: black;
72+
}
73+
74+
body.dark nav{
75+
background: white;
76+
}
77+
78+
body.dark .list {
79+
color: white;
80+
border: 1px solid white;
81+
}
82+
83+
body.dark .about_chryzhub{
84+
color: white;
85+
}
86+
87+
body.dark footer{
88+
background: white;
89+
}
90+
91+
body.dark .footer-bottom{
92+
color: black;
93+
}
94+
95+
body.dark .footer-bottom a{
96+
color: black;
1197
}
1298

1399
.row{
@@ -33,6 +119,7 @@ p{
33119
color: white;
34120
margin-left: auto;
35121
margin-right: auto;
122+
padding-left: 50px;
36123
}
37124

38125
.about_chryzhub{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy