Skip to content

Commit 9e27e8e

Browse files
authored
feat(carousel): improve carousel theme and add missed properties (#15525)
1 parent 0048844 commit 9e27e8e

File tree

1 file changed

+103
-23
lines changed

1 file changed

+103
-23
lines changed

projects/igniteui-angular/src/lib/core/styles/components/carousel/_carousel-theme.scss

Lines changed: 103 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
/// @param {Color} $button-disabled-arrow-color [null] - The previous/next buttons disabled arrow color.
2222
/// @param {Color} $button-border-color [null] - The previous/next buttons idle border color.
2323
/// @param {Color} $button-hover-border-color [null] - The previous/next buttons hover border color.
24+
/// @param {Color} $button-focus-border-color [null] - The navigation buttons border color on focus.
2425
/// @param {Color} $button-disabled-border-color [null] - The previous/next buttons disabled border color.
26+
/// @param {Color} $indicator-background [null] - The indicators container background color.
27+
/// @param {Color} $label-indicator-background [null] - The label indicator container background color.
2528
/// @param {Color} $indicator-dot-color [null] - The idle indicator dot color.
2629
/// @param {Color} $indicator-hover-dot-color [null] - The hover indicator dot color.
30+
/// @param {Color} $indicator-focus-color [null] - The indicators border and dot color on focus.
2731
/// @param {Color} $indicator-border-color [null] - The idle indicator border color.
2832
/// @param {Color} $indicator-active-dot-color [null] - The active indicator dot color.
2933
/// @param {Color} $indicator-active-border-color [null] - The active indicator border color.
@@ -54,13 +58,18 @@
5458
$button-disabled-background: null,
5559
$button-arrow-color: null,
5660
$button-hover-arrow-color: null,
61+
$button-focus-arrow-color: null,
5762
$button-disabled-arrow-color: null,
5863
$button-border-color: null,
5964
$button-hover-border-color: null,
65+
$button-focus-border-color: null,
6066
$button-disabled-border-color: null,
6167
68+
$indicator-background: null,
69+
$label-indicator-background: null,
6270
$indicator-dot-color: null,
6371
$indicator-hover-dot-color: null,
72+
$indicator-focus-color: null,
6473
$indicator-border-color: null,
6574
$indicator-active-dot-color: null,
6675
$indicator-active-border-color: null,
@@ -76,24 +85,106 @@
7685
}
7786

7887
$theme: digest-schema($carousel-schema);
79-
$meta: map.get($theme, '_meta');
88+
$variant: map.get($theme, '_meta', 'theme');
89+
90+
@if $variant == 'indigo' {
91+
@if not($button-hover-background) and $button-background {
92+
$button-hover-background: hsl(from var(--button-background) h s calc(l * 0.9));
93+
}
94+
95+
@if not($button-border-color) and $button-background {
96+
$button-border-color: hsl(from var(--button-background) h s calc(l * 0.9));
97+
}
98+
99+
@if not($button-hover-border-color) and $button-border-color {
100+
$button-hover-border-color: hsl(from var(--button-border-color) h s calc(l * 0.9));
101+
}
102+
103+
@if not($indicator-active-dot-color) and not($indicator-background) and $button-background {
104+
$indicator-active-dot-color: var(--button-background);
105+
}
106+
}
80107

81108
@if not($button-shadow) {
82109
$button-elevation: map.get($carousel-schema, 'button-elevation');
83110
$button-shadow: elevation($button-elevation);
84111
}
85112

86113
@if not($button-arrow-color) and $button-background {
87-
$button-arrow-color: text-contrast($button-background);
114+
$button-arrow-color: hsla(from (adaptive-contrast(var(--button-background)) h s l / 0.85));
115+
}
116+
117+
@if not($button-hover-background) and $button-background {
118+
$button-hover-background: var(--button-background);
88119
}
89120

90121
@if not($button-hover-arrow-color) and $button-hover-background {
91-
$button-hover-arrow-color: text-contrast($button-hover-background);
122+
$button-hover-arrow-color: adaptive-contrast(var(--button-hover-background));
123+
}
124+
125+
@if not($button-focus-arrow-color) and $button-hover-arrow-color {
126+
$button-focus-arrow-color: var(--button-hover-arrow-color);
127+
}
128+
129+
@if not($button-disabled-background) and $button-background {
130+
$button-disabled-background: var(--button-background);
92131
}
93132

94133
@if not($button-disabled-arrow-color) and $button-disabled-background {
95-
@if meta.type-of($button-disabled-background) == 'color' {
96-
$button-disabled-arrow-color: rgba(text-contrast($button-disabled-background), .3);
134+
$button-disabled-arrow-color: hsla(from adaptive-contrast(var(--button-disabled-background)) h s l / .4);
135+
}
136+
137+
@if not($indicator-dot-color) and $indicator-background {
138+
$indicator-dot-color: hsla(from adaptive-contrast(var(--indicator-background)) h s l / .8);
139+
}
140+
141+
@if not($indicator-hover-dot-color) and $indicator-dot-color {
142+
$indicator-hover-dot-color: hsla(from var(--indicator-dot-color) h s l / 1);
143+
}
144+
145+
@if not($indicator-border-color) and $indicator-dot-color {
146+
$indicator-border-color: var(--indicator-dot-color);
147+
}
148+
149+
@if not($indicator-active-dot-color) and $indicator-background {
150+
$indicator-active-dot-color: hsl(from adaptive-contrast(var(--indicator-background)) h s calc(l * 0.9));
151+
}
152+
153+
@if not($indicator-active-hover-dot-color) and $indicator-active-dot-color {
154+
$indicator-active-hover-dot-color: hsl(from var(--indicator-active-dot-color) h s calc(l * 1.1));
155+
}
156+
157+
@if not($indicator-active-border-color) and $indicator-active-dot-color {
158+
$indicator-active-border-color: var(--indicator-active-dot-color);
159+
}
160+
161+
@if $variant == 'material' {
162+
@if not($button-focus-border-color) and $button-focus-arrow-color {
163+
$button-focus-border-color: var(--button-focus-arrow-color);
164+
}
165+
}
166+
167+
@if $variant == 'fluent' or $variant == 'bootstrap' {
168+
@if not($button-focus-border-color) and $button-background {
169+
$button-focus-border-color: hsla(from adaptive-contrast(var(--button-background)) h s l / 0.5);
170+
}
171+
}
172+
173+
@if $variant == 'indigo' {
174+
@if not($button-focus-border-color) and $indicator-active-dot-color {
175+
$button-focus-border-color: var(--indicator-active-dot-color);
176+
}
177+
178+
@if not($indicator-focus-color) and $indicator-active-hover-dot-color {
179+
$indicator-focus-color: hsla(from var(--indicator-active-hover-dot-color) h s l / .5);
180+
}
181+
} @else {
182+
@if not($indicator-focus-color) and not($indicator-background) and $button-background {
183+
$indicator-focus-color: var(--button-background);
184+
}
185+
186+
@if not($indicator-focus-color) and $indicator-background {
187+
$indicator-focus-color: adaptive-contrast(var(--indicator-background));
97188
}
98189
}
99190

@@ -110,21 +201,22 @@
110201
button-hover-background: $button-hover-background,
111202
button-arrow-color: $button-arrow-color,
112203
button-hover-arrow-color: $button-hover-arrow-color,
204+
button-focus-arrow-color: $button-focus-arrow-color,
113205
button-disabled-arrow-color: $button-disabled-arrow-color,
114206
button-border-color: $button-border-color,
115207
button-hover-border-color: $button-hover-border-color,
208+
button-focus-border-color: $button-focus-border-color,
116209
button-disabled-border-color: $button-disabled-border-color,
117210

211+
indicator-background: $indicator-background,
212+
label-indicator-background: $label-indicator-background,
118213
indicator-dot-color: $indicator-dot-color,
119214
indicator-hover-dot-color: $indicator-hover-dot-color,
215+
indicator-focus-color: $indicator-focus-color,
120216
indicator-border-color: $indicator-border-color,
121217
indicator-active-dot-color: $indicator-active-dot-color,
122218
indicator-active-border-color: $indicator-active-border-color,
123219
indicator-active-hover-dot-color: $indicator-active-hover-dot-color,
124-
theme: map.get($schema, '_meta', 'theme'),
125-
_meta: map.merge(if($meta, $meta, ()), (
126-
variant: map.get($schema, '_meta', 'theme')
127-
)),
128220
));
129221
}
130222

@@ -139,7 +231,7 @@
139231
$indicator-border-style: rem(2px) solid;
140232
$btn-indent: rem(3px);
141233

142-
$variant: map.get($theme, '_meta', 'variant');
234+
$variant: map.get($theme, '_meta', 'theme');
143235
$not-bootstrap-theme: $variant != 'bootstrap';
144236

145237
%igx-carousel-display {
@@ -206,25 +298,17 @@
206298
border: rem(2px) solid var-get($theme, 'button-focus-border-color');
207299

208300
igx-icon {
209-
color: var-get($theme, 'button-focus-border-color');
301+
color: var-get($theme, 'button-focus-arrow-color');
210302
}
211303

212304
@if $variant == 'bootstrap' {
213305
box-shadow: 0 0 0 rem(4px) var-get($theme, 'button-focus-border-color');
214306
border-color: var-get($theme, 'button-border-color');
215-
216-
igx-icon {
217-
color: var-get($theme, 'button-arrow-color');
218-
}
219307
}
220308

221309
@if $variant == 'fluent' {
222310
border: none;
223311

224-
igx-icon {
225-
color: var-get($theme, 'indicator-focus-color');
226-
}
227-
228312
&::after {
229313
position: absolute;
230314
content: '';
@@ -239,10 +323,6 @@
239323

240324
@if $variant == 'indigo' {
241325
box-shadow: 0 0 0 rem(3px) var-get($theme, 'indicator-focus-color');
242-
243-
igx-icon {
244-
color: var-get($theme, 'button-arrow-color');
245-
}
246326
}
247327
}
248328

0 commit comments

Comments
 (0)