Bu kodlar ile sitenizde kullanabileceğiniz Açık/Koyu mod elde edebilirsiniz.
Nasıl görünüyor;
Açık Mod
Nasıl görünüyor;
Koyu Mod
İndex(Html) Kaynak Kodu
Nasıl görünüyor;
Açık Mod
Nasıl görünüyor;
Koyu Mod
İndex(Html) Kaynak Kodu
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>TurkHackteam</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<input type="checkbox" id="dark-mode">
<label for="dark-mode"></label>
<div class="background"></div>
</body>
</html>
Stlye(Css) Kaynak Kodu
CSS:
*{
margin: 0%;
padding: 0%;
box-sizing: border-box;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}
body{
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
label{
position: relative;
width: 480px;
height: 180px;
display: block;
background: white;
border-radius: 100px;
cursor: pointer;
box-shadow: inset 0px 5px 15px rgba(0,0,0,0.3),
inset 0px -5px 15px rgba(255, 255, 255, 0.3)
}
label::after {
content: "";
position: absolute;
height: 160px;
width: 160px;
background: white;
border-radius: 100px;
top: 10px;
left: 10px;
transition: 0.5s;
box-shadow: 0 5px 10px rgba(0,0,0,0.2)
}
input:checked ~ label::after{
left: 470px;
transform: translateX(-100%);
background: linear-gradient(180deg, #777, #3a3a3a);
}
input:checked ~ label{
background: black;
}
.background{
position: absolute;
width: 100%;
height: 100vh;
background: white;
z-index: -1;
transition: 0.5s;
}
input:checked +label +.background{
background: #242424;
}
input{
display: none;
}
Bu kodları sitenize entegre ederek sitenizde göz yorgunluğu açısından site misafirlerinize bu fırsatı sunabilirsiniz.