buildsomething/sass/darkmode_toggle.scss

61 lines
1.2 KiB
SCSS
Raw Normal View History

2024-11-09 20:49:46 +01:00
:root {
2024-11-09 22:31:00 +01:00
/*--primary-color: var(--primary-color); */
/* --primary-text-color: var(--primary-text-color); */
2024-11-09 20:49:46 +01:00
}
2024-11-09 23:56:55 +01:00
$diameter: 1em;
2024-11-09 20:49:46 +01:00
2024-11-09 23:56:55 +01:00
.toggle-dark {
2024-11-09 20:49:46 +01:00
position: relative;
2024-11-09 23:56:55 +01:00
width: 2em;
display: inline-block;
top: -0.8em;
label {
position: absolute;
width: 100%;
height: $diameter * 1.0;
background-color: var(--primary-text-color);
border-radius: $diameter / 2 * 1.2;
cursor: pointer;
input {
position: absolute;
display: none;
}
input:checked~.slider {
/* background-color: var(--primary-color); */
}
input:checked~.slider::before {
transform: translateX($diameter * 0.95);
background-color: var(--primary-color);
box-shadow: none;
}
.slider {
position: absolute;
width: 100%;
height: 100%;
border-radius: $diameter / 2.5;
transition: 0.3s;
}
.slider::before {
content: "";
position: absolute;
top: $diameter * 0.13;
left: $diameter * 0.16;
width: $diameter * 0.75;
height: $diameter * 0.75;
border-radius: 50%;
box-shadow: inset $diameter * .28 $diameter * -.04 0px 0px var(--primary-color);
background-color: var(--primary--color);
transition: 0.3s;
}
}
2024-11-09 20:49:46 +01:00
}