awesome-www/css/mode-switch.css

95 lines
1.6 KiB
CSS

/**
* Dark/Light Theme Switcher build on Checkbox and UL/LI structure
*/
.mode-switch {
display: flex;
position: absolute;
top: 0.5rem;
right: 0.5rem;
}
.mode-switch>li {
list-style: none;
margin-right: 6px;
}
.mode-switch-icon {
padding: 0px 0px 0px 32px;
list-style: none;
margin: 0;
}
.mode-switch-dark {
background: url(../images/icons/moon.svg) no-repeat left top;
background-size: 32px 32px;
filter: invert(100%);
}
.mode-switch-light {
background: url(../images/icons/sun.svg) no-repeat left top;
background-size: 32px 32px;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: 0.4s;
transition: 0.4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: #fafafa;
-webkit-transition: 0.4s;
transition: 0.4s;
}
input:checked+.slider {
background-color: #59929d;
}
input:focus+.slider {
box-shadow: 0 0 1px #59929d;
}
input:checked+.slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}