buildsomething/sass/darkmode_toggle.scss
2024-11-09 20:49:46 +01:00

88 lines
1.4 KiB
SCSS

:root {
--light: #d8dbe0;
--dark: #28292c;
--link: rgb(27, 129, 112);
--link-hover: rgb(24, 94, 82);
}
* {
/* padding: 0; */
/* margin: 0; */
/* box-sizing: border-box; */
}
body {
/* background-color: #cfafaf; */
/* display: flex; */
/* justify-content: center; */
/* align-items: center; */
/* height: 100vh; */
}
$diameter: 100;
.toggle-switch {
position: relative;
width: 200px;
}
label {
position: absolute;
width: 100%;
height: 100px;
background-color: var(--dark);
border-radius: 50px;
cursor: pointer;
}
input {
position: absolute;
display: none;
}
.slider {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50px;
transition: 0.3s;
}
input:checked~.slider {
background-color: var(--light);
}
.slider::before {
content: "";
position: absolute;
top: 13px;
left: 16px;
width: 75px;
height: 75px;
border-radius: 50%;
box-shadow: inset 28px -4px 0px 0px var(--light);
background-color: var(--dark);
transition: 0.3s;
}
input:checked~.slider::before {
transform: translateX(95px);
background-color: var(--dark);
box-shadow: none;
}
a {
position: relative;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
top: 150px;
left: 10px;
font-size: 10px;
text-decoration: none;
color: var(--link);
font-weight: bold;
text-align: center;
}
a:hover {
color: var(--link-hover);
}