80 lines
1.7 KiB
CSS
80 lines
1.7 KiB
CSS
.operator-switch {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5em;
|
|
cursor: pointer;
|
|
font-family: sans-serif;
|
|
/* Change this font-size to scale the whole component */
|
|
font-size: 12px;
|
|
}
|
|
|
|
/* hide the default checkbox */
|
|
.operator-switch input {
|
|
display: none;
|
|
}
|
|
|
|
/* The Track */
|
|
.switch-visual {
|
|
position: relative;
|
|
/* height is now 3x the font size */
|
|
height: 3em;
|
|
aspect-ratio: 1 / 2;
|
|
background-color: ButtonFace;
|
|
border-radius: 2em;
|
|
transition: 0.2s;
|
|
}
|
|
|
|
/* The Knob */
|
|
.switch-visual::after {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0.1em;
|
|
left: 0.1em;
|
|
width: 1em;
|
|
height: 1em;
|
|
background: Canvas;
|
|
border: 0.175em solid mediumpurple;
|
|
border-radius: 50%;
|
|
transition: transform 0.2s ease-in-out, border-color 0.2s;
|
|
}
|
|
|
|
/* Labels */
|
|
.switch-labels {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
height: 3em; /* Matches the track height */
|
|
font-weight: 800;
|
|
color: Canvas;
|
|
line-height: 1.4;
|
|
padding: 0.2em 0;
|
|
}
|
|
|
|
.operator-switch input:checked + .switch-visual::after {
|
|
/* Moves the slider down */
|
|
transform: translateY(1.4em);
|
|
}
|
|
|
|
/*change the colours to highlight the selected operator*/
|
|
.operator-switch input:checked ~ .switch-labels{
|
|
:first-child {
|
|
transition: ease-in-out color 0.2s;
|
|
color: ButtonFace;
|
|
}
|
|
:last-child {
|
|
transition: ease-in-out color 0.2s;
|
|
color: mediumpurple;
|
|
}
|
|
}
|
|
|
|
.operator-switch input:not(:checked) ~ .switch-labels{
|
|
:first-child {
|
|
transition: ease-in-out color 0.2s;
|
|
color: mediumpurple;
|
|
}
|
|
:last-child {
|
|
transition: ease-in-out color 0.2s;
|
|
color: ButtonFace;
|
|
}
|
|
|
|
} |