src/core-slider/CoreSliderElement.css
:host {
display: inline-block;
contain: content;
width: 100%;
height: auto;
color: var(--primary, white);
--thumb-color: currentColor;
--thumb-size: 1rem;
--thumb-border-width: 1px;
--track-color: var(--light, lightgray);
--track-height: 0.5rem;
--outline-color: var(--secondary, gray);
--progress-color: var(--thumb-color);
}
:host([disabled]) {
--thumb-color: var(--outline-color);
--progress-color: var(--track-color);
pointer-events: none;
cursor: default;
}
#slider {
position: relative;
margin: calc(var(--thumb-size) + var(--thumb-border-width));
width: calc(100% - (var(--thumb-size) + var(--thumb-border-width)) * 2 - 2px); /* 2px for border-width */
height: calc(var(--track-height) + 2px);/* 2px for border-width */
}
#slider-bar {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: var(--track-height);
background-color: var(--track-color);
border: 1px solid var(--outline-color);
border-radius: var(--track-height);
cursor: pointer;
}
#slider-thumb {
display: block;
position: absolute;
top: 0px;/* Will be controlled in updateThumbPosition() */
left: 0px;/* Will be controlled in updateThumbPosition() */
cursor: pointer;
width: var(--thumb-size);
height: var(--thumb-size);
transform: translate(-50%, -50%);
background-color: var(--thumb-color);
border-color: var(--outline-color);
border-style: solid;
border-radius: 100%;
border-width: var(--thumb-border-width);
margin-top: calc(var(--track-height) / 2 + 1px);/* 1px for border-width */
margin-left: 0px;
transition: background-color 0.15s ease-in-out,
box-shadow 0.15s ease-in-out;
}
#slider-progress {
position: absolute;
display: block;
width: 100%;
height: 100%;
min-width: var(--track-height);
max-width: 100%;
min-height: var(--track-height);
max-height: 100%;
background: var(--progress-color);
border-radius: var(--track-height);
}
:host([vertical]) {
/* Same as default, but flipped width and height */
width: auto;
height: 100%;
}
:host([vertical]) div#slider {
/* Same as default, but flipped width and height */
width: calc(var(--track-height) + 2px);
height: calc(100% - (var(--thumb-size) + var(--thumb-border-width)) * 2 - 2px);
}
:host([vertical]) span#slider-bar {
/* Same as default, but flipped width and height */
width: var(--track-height);
height: 100%;
}
:host([vertical]) span#slider-thumb {
/* Same as default, but flipped width and height */
margin-top: 0px;
margin-left: calc(var(--track-height) / 2 + 1px);
}
:host([vertical]) span#slider-progress {
position: absolute;
bottom: 0px;
}
/* Bootstrap support for form-control-range */
:host(.form-control-range) {
display: block;
}
/* Bootstrap support for custom-range */
:host(.custom-range) {
--outline-color: transparent;
--thumb-border-width: 0.4rem;
--thumb-size: 0.6rem;
--track-color: #dee2e6;
}
:host(.custom-range[disabled]) {
--thumb-color: #adb5bd!important;
}
:host(.custom-range:not([color])) {
--thumb-color:#007bff;
}
:host(.custom-range[color]) {
--thumb-color: currentColor;
--progress-color: currentColor;
--track-color: #dee2e6;
}
:host(.custom-range) span#slider-thumb {
border-color: var(--thumb-color);
background: var(--white, white);
}
:host(.custom-range) span#slider-thumb.focus {
--thumb-color: #b3d7ff;
box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
@media (prefers-reduced-motion: reduce) {
:host(.custom-range) span#slider-thumb {
transition: none;
}
}
@keyframes rainbow {
0% { color: var(--red, 'red'); }
15% { color: var(--orange, 'orange'); }
30% { color: var(--yellow, 'yellow'); }
45% { color: var(--green, 'green') }
60% { color: var(--blue, 'blue'); }
75% { color: var(--indigo, 'indigo'); }
90% { color: var(--pink, 'pink'); }
100%{ color: var(--red, 'red'); }
}