Skip to content

Commit 32a5f37

Browse files
authored
feat(slider): improve slider theme (#15743)
1 parent a04f481 commit 32a5f37

File tree

1 file changed

+92
-7
lines changed

1 file changed

+92
-7
lines changed

projects/igniteui-angular/src/lib/core/styles/components/slider/_slider-theme.scss

Lines changed: 92 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,99 @@
7171
}
7272

7373
$theme: digest-schema($slider-schema);
74-
$meta: map.get($theme, '_meta');
74+
$variant: map.get($theme, '_meta', 'theme');
75+
76+
@if $variant == 'fluent' or $variant == 'indigo' {
77+
@if not($thumb-border-color) and $track-color {
78+
$thumb-border-color: var(--track-color);
79+
}
80+
81+
@if not($track-color) and $thumb-border-color {
82+
$track-color: var(--thumb-border-color);
83+
}
84+
85+
@if not($thumb-border-hover-color) and $thumb-border-color {
86+
$thumb-border-hover-color: hsl(from var(--thumb-border-color) h s calc(l * 1.1));
87+
}
88+
89+
@if $variant == 'fluent' {
90+
@if not($thumb-focus-color) and $thumb-border-color {
91+
$thumb-focus-color: hsl(from var(--thumb-border-color) h s calc(l * 1.2));
92+
}
93+
} @else {
94+
@if not($thumb-focus-color) and $thumb-border-color {
95+
$thumb-focus-color: hsla(from var(--thumb-border-color) h s l / 0.3);
96+
}
97+
}
98+
}
99+
100+
@if $variant == 'material' {
101+
@if not($thumb-color) and $track-color {
102+
$thumb-color: var(--track-color);
103+
}
104+
105+
@if not($track-color) and $thumb-color {
106+
$track-color: var(--thumb-color);
107+
}
108+
109+
@if not($base-track-color) and $track-color {
110+
$base-track-color: hsla(from var(--track-color) h s l / 0.4);
111+
}
112+
}
113+
114+
@if $variant == 'bootstrap' {
115+
@if not($thumb-border-color) and $thumb-color {
116+
$thumb-border-color: var(--thumb-color);
117+
}
118+
119+
@if not($thumb-focus-color) and $thumb-color {
120+
$thumb-focus-color: hsla(from var(--thumb-color) h s l / 0.5);
121+
}
122+
}
123+
124+
@if not($track-hover-color) and $track-color {
125+
$track-hover-color: hsl(from var(--track-color) h s calc(l * 1.1));
126+
}
127+
128+
@if $variant != 'bootstrap' {
129+
@if not($label-background-color) and $track-color {
130+
$label-background-color: var(--track-color);
131+
}
132+
} @else {
133+
@if not($label-background-color) and $thumb-color {
134+
$label-background-color: var(--thumb-color);
135+
}
136+
}
137+
75138

76139
@if not($label-text-color) and $label-background-color {
77-
$label-text-color: text-contrast($label-background-color);
140+
$label-text-color: adaptive-contrast($label-background-color);
141+
}
142+
143+
@if $variant != 'indigo' {
144+
@if not($base-track-hover-color) and $base-track-color {
145+
$base-track-hover-color: var(--base-track-color);
146+
}
147+
} @else {
148+
@if not($base-track-hover-color) and $base-track-color {
149+
$base-track-hover-color: hsl(from var(--base-track-color) h s calc(l * 0.8));
150+
}
151+
}
152+
153+
@if not($disabled-base-track-color) and $base-track-color {
154+
$disabled-base-track-color: hsla(from var(--base-track-color) h s l / 0.5);
155+
}
156+
157+
@if not($disabled-fill-track-color) and $track-color {
158+
$disabled-fill-track-color: hsla(from var(--track-color) h s l / 0.5);
159+
}
160+
161+
@if not($disabled-thumb-color) and $thumb-color {
162+
$disabled-thumb-color: hsl(from var(--thumb-color) h calc(s * 0.5) calc(l * 1.2));
163+
}
164+
165+
@if not($thumb-disabled-border-color) and $thumb-border-color {
166+
$thumb-disabled-border-color: hsla(from var(--thumb-border-color) h s l / 0.5);
78167
}
79168

80169
@return extend($theme, (
@@ -98,10 +187,6 @@
98187
disabled-fill-track-color: $disabled-fill-track-color,
99188
tick-label-color: $tick-label-color,
100189
tick-color: $tick-color,
101-
theme: map.get($schema, '_meta', 'theme'),
102-
_meta: map.merge(if($meta, $meta, ()), (
103-
variant: map.get($schema, '_meta', 'theme')
104-
)),
105190
));
106191
}
107192

@@ -111,7 +196,7 @@
111196
@mixin slider($theme) {
112197
@include css-vars($theme);
113198

114-
$variant: map.get($theme, '_meta', 'variant');
199+
$variant: map.get($theme, '_meta', 'theme');
115200

116201
$slider-height: rem(48px);
117202
$ripple-size: rem(40px);

0 commit comments

Comments
 (0)