|
11 | 11 | /// @param {Color} $background [null] - The list background color. |
12 | 12 | /// @param {Color} $header-background [null] - The list header background color. |
13 | 13 | /// @param {Color} $header-text-color [null] - The list header text color. |
| 14 | +/// |
14 | 15 | /// @param {Color} $item-background [null] - The list item background color. |
15 | | -/// @param {Color} $item-text-color [null] - The list item text color. |
| 16 | +/// @param {Color} $item-background-hover [null] - The list item hover background color. |
16 | 17 | /// @param {Color} $item-background-active [null] - The active list item background color. |
| 18 | +// |
| 19 | +/// @param {Color} $item-text-color [null] - The list item text color. |
| 20 | +/// @param {Color} $item-text-color-hover [null] - The list item hover text color. |
17 | 21 | /// @param {Color} $item-text-color-active [null] - The active list item text color. |
18 | 22 | /// |
| 23 | +/// @param {Color} $item-title-color [null] - The list item title color. |
| 24 | +/// @param {Color} $item-title-color-hover [null] - The list item hover title color. |
| 25 | +/// @param {Color} $item-title-color-active [null] - The active list item title color. |
| 26 | +/// |
| 27 | +/// @param {Color} $item-subtitle-color [null] - The list item subtitle color. |
| 28 | +/// @param {Color} $item-subtitle-color-hover [null] - The list item hover subtitle color. |
| 29 | +/// @param {Color} $item-subtitle-color-active [null] - The active list item subtitle color. |
| 30 | +/// |
| 31 | +/// @param {Color} $item-action-color [null] - The list item action color. |
| 32 | +/// @param {Color} $item-action-color-hover [null] - The list item hover action color. |
| 33 | +/// @param {Color} $item-action-color-active [null] - The active list item action color. |
| 34 | +/// |
| 35 | +/// @param {Color} $item-thumbnail-color [null] - The list item thumbnail color. |
| 36 | +/// @param {Color} $item-thumbnail-color-hover [null] - The list item hover thumbnail color. |
| 37 | +/// @param {Color} $item-thumbnail-color-active [null] - The active list item thumbnail color. |
| 38 | +/// |
19 | 39 | /// @param {border-radius} $border-radius [null] - The border radius used for list component. |
20 | 40 | /// @param {border-radius} $item-border-radius [null] - The border radius used for list item. |
21 | 41 | /// |
22 | 42 | /// @requires $default-palette |
23 | 43 | /// @requires $light-schema |
24 | 44 | /// @requires apply-palette |
25 | 45 | /// @requires extend |
| 46 | +/// @requires hexrgba |
26 | 47 | /// @requires text-contrast |
27 | 48 | /// @requires round-borders |
28 | 49 | /// |
|
45 | 66 | $item-text-color: null, |
46 | 67 | $item-text-color-hover: null, |
47 | 68 | $item-text-color-active: null, |
| 69 | + $item-title-color: null, |
| 70 | + $item-title-color-hover: null, |
| 71 | + $item-title-color-active: null, |
48 | 72 | $item-subtitle-color: null, |
49 | 73 | $item-subtitle-color-hover: null, |
50 | 74 | $item-subtitle-color-active: null, |
| 75 | + $item-action-color: null, |
| 76 | + $item-action-color-hover: null, |
| 77 | + $item-action-color-active: null, |
| 78 | + $item-thumbnail-color: null, |
| 79 | + $item-thumbnail-color-hover: null, |
| 80 | + $item-thumbnail-color-active: null |
51 | 81 | ) { |
52 | 82 | $name: 'igx-list'; |
53 | 83 | $list-schema: map-get($schema, $name); |
|
78 | 108 | } |
79 | 109 |
|
80 | 110 | @if not($item-background-hover) and $item-background { |
81 | | - $item-background-hover: rgba(text-contrast($item-background), .1); |
| 111 | + @if type-of($item-background) == 'color' and luminance($item-background) < .5 { |
| 112 | + $item-background-hover: lighten-color($item-background, 8%); |
| 113 | + } @else { |
| 114 | + $item-background-hover: darken-color($item-background, 8%); |
| 115 | + } |
82 | 116 | } |
83 | 117 |
|
84 | 118 | @if not($item-background-active) and $item-background { |
85 | | - $item-background-active: rgba(text-contrast($item-background), .1); |
| 119 | + @if type-of($item-background) == 'color' and luminance($item-background) < .5 { |
| 120 | + $item-background-active: lighten-color($item-background, 8%); |
| 121 | + } @else { |
| 122 | + $item-background-active: darken-color($item-background, 8%); |
| 123 | + } |
86 | 124 | } |
87 | 125 |
|
88 | 126 | @if not($header-text-color) and $header-background { |
|
93 | 131 | $item-text-color: text-contrast($item-background); |
94 | 132 | } |
95 | 133 |
|
96 | | - @if not($item-text-color-hover) and $item-background { |
97 | | - $item-text-color-hover: text-contrast($item-background); |
| 134 | + @if not($item-title-color) and $item-background { |
| 135 | + $item-title-color: text-contrast($item-background); |
98 | 136 | } |
99 | 137 |
|
100 | | - @if not($item-text-color-hover) and $item-background-hover { |
101 | | - $item-text-color-hover: text-contrast($item-background-hover); |
| 138 | + @if not($item-action-color) and $item-background { |
| 139 | + $item-action-color: text-contrast($item-background); |
| 140 | + } |
| 141 | + |
| 142 | + @if not($item-thumbnail-color) and $item-background { |
| 143 | + $item-thumbnail-color: text-contrast($item-background); |
102 | 144 | } |
103 | 145 |
|
104 | 146 | @if not($item-subtitle-color) and $item-background { |
105 | 147 | $item-subtitle-color: rgba(text-contrast($item-background), .74); |
106 | 148 | } |
107 | 149 |
|
108 | | - @if not($item-subtitle-color-hover) and $item-background { |
109 | | - $item-subtitle-color-hover: rgba(text-contrast($item-background), .74); |
| 150 | + @if not($item-subtitle-color) and $item-text-color { |
| 151 | + $item-subtitle-color: $item-text-color; |
110 | 152 | } |
111 | 153 |
|
112 | | - @if not($item-subtitle-color-hover) and $item-background-hover { |
113 | | - $item-subtitle-color-hover: rgba(text-contrast($item-background-hover), .74); |
| 154 | + @if not($item-text-color-hover) and $item-background-hover { |
| 155 | + $item-text-color-hover: text-contrast($item-background-hover); |
| 156 | + } |
| 157 | + |
| 158 | + @if not($item-title-color-hover) and $item-background-hover { |
| 159 | + $item-title-color-hover: text-contrast($item-background-hover); |
| 160 | + } |
| 161 | + |
| 162 | + @if not($item-action-color-hover) and $item-background-hover { |
| 163 | + $item-action-color-hover: text-contrast($item-background-hover); |
114 | 164 | } |
115 | 165 |
|
116 | | - @if not($item-subtitle-color-active) and $item-background { |
117 | | - $item-subtitle-color-active: rgba(text-contrast($item-background), .74); |
| 166 | + @if not($item-thumbnail-color-hover) and $item-background-hover { |
| 167 | + $item-thumbnail-color-hover: text-contrast($item-background-hover); |
118 | 168 | } |
119 | 169 |
|
120 | | - @if not($item-text-color-active) and $item-background { |
121 | | - $item-text-color-active: text-contrast($item-background); |
| 170 | + @if not($item-subtitle-color-hover) and $item-background-hover { |
| 171 | + $item-subtitle-color-hover: rgba(text-contrast($item-background-hover), .74); |
| 172 | + } |
| 173 | + |
| 174 | + @if not($item-subtitle-color-hover) and $item-text-color-hover { |
| 175 | + $item-subtitle-color-hover: $item-text-color-hover; |
122 | 176 | } |
123 | 177 |
|
124 | 178 | @if not($item-text-color-active) and $item-background-active { |
125 | 179 | $item-text-color-active: text-contrast($item-background-active); |
126 | 180 | } |
127 | 181 |
|
| 182 | + @if not($item-title-color-active) and $item-background-active { |
| 183 | + $item-title-color-active: text-contrast($item-background-active); |
| 184 | + } |
| 185 | + |
| 186 | + @if not($item-action-color-active) and $item-background-active { |
| 187 | + $item-action-color-active: text-contrast($item-background-active); |
| 188 | + } |
| 189 | + |
| 190 | + @if not($item-thumbnail-color-active) and $item-background-active { |
| 191 | + $item-thumbnail-color-active: text-contrast($item-background-active); |
| 192 | + } |
| 193 | + |
| 194 | + @if not($item-subtitle-color-active) and $item-background-active { |
| 195 | + $item-subtitle-color-active: rgba(text-contrast($item-background-active), .74); |
| 196 | + } |
| 197 | + |
| 198 | + @if not($item-subtitle-color-active) and $item-text-color-active { |
| 199 | + $item-subtitle-color-active: $item-text-color-active; |
| 200 | + } |
128 | 201 |
|
129 | 202 | @return extend($theme, ( |
130 | 203 | name: $name, |
|
140 | 213 | item-text-color: $item-text-color, |
141 | 214 | item-text-color-hover: $item-text-color-hover, |
142 | 215 | item-text-color-active: $item-text-color-active, |
| 216 | + item-title-color:$item-title-color, |
| 217 | + item-title-color-hover:$item-title-color-hover, |
| 218 | + item-title-color-active:$item-title-color-active, |
143 | 219 | item-subtitle-color: $item-subtitle-color, |
144 | 220 | item-subtitle-color-hover: $item-subtitle-color-hover, |
145 | 221 | item-subtitle-color-active: $item-subtitle-color-active, |
| 222 | + item-action-color: $item-action-color, |
| 223 | + item-action-color-hover: $item-action-color-hover, |
| 224 | + item-action-color-active: $item-action-color-active, |
| 225 | + item-thumbnail-color: $item-thumbnail-color, |
| 226 | + item-thumbnail-color-hover: $item-thumbnail-color-hover, |
| 227 | + item-thumbnail-color-active: $item-thumbnail-color-active |
146 | 228 | )); |
147 | 229 | } |
148 | 230 |
|
|
255 | 337 | z-index: 1; |
256 | 338 | } |
257 | 339 |
|
| 340 | + %igx-list__item-lines { |
| 341 | + color: --var($theme, 'item-text-color'); |
| 342 | + display: flex; |
| 343 | + flex-direction: column; |
| 344 | + flex: 1 0 0%; |
| 345 | + |
| 346 | + &:empty { |
| 347 | + display: none; |
| 348 | + } |
| 349 | + } |
| 350 | + |
258 | 351 | %igx-list__item-line-subtitle { |
259 | | - color: --var($theme, 'item-subtitle-color') |
| 352 | + color: --var($theme, 'item-subtitle-color'); |
| 353 | + opacity: .74 |
| 354 | + } |
| 355 | + |
| 356 | + %igx-list__item-line-title { |
| 357 | + color: --var($theme, 'item-title-color'); |
| 358 | + } |
| 359 | + |
| 360 | + %igx-list__item-actions { |
| 361 | + display: flex; |
| 362 | + align-items: center; |
| 363 | + justify-content: center; |
| 364 | + color: --var($theme, 'item-action-color'); |
| 365 | + |
| 366 | + > * { |
| 367 | + margin-left: rem(8px); |
| 368 | + } |
| 369 | + |
| 370 | + &:empty { |
| 371 | + display: none; |
| 372 | + } |
| 373 | + |
| 374 | + %igx-icon-display { |
| 375 | + color: --var($theme, 'item-action-color') |
| 376 | + } |
260 | 377 | } |
261 | 378 |
|
262 | 379 | %igx-list-item-content { |
|
269 | 386 | border-radius: --var($theme, 'item-border-radius'); |
270 | 387 | z-index: 2; |
271 | 388 |
|
272 | | - %igx-list__item-line-title, |
273 | | - %igx-list__item-lines { |
274 | | - color: --var($theme, 'item-text-color'); |
275 | | - } |
276 | | - |
277 | 389 | &:hover { |
278 | 390 | color: --var($theme, 'item-text-color-hover'); |
279 | 391 | background: --var($theme, 'item-background-hover'); |
280 | 392 |
|
281 | | - %igx-list__item-line-title, |
282 | 393 | %igx-list__item-lines { |
283 | | - color: --var($theme, 'item-text-color-hover'); |
| 394 | + color: currentColor; |
| 395 | + } |
| 396 | + |
| 397 | + %igx-list__item-line-title { |
| 398 | + color: --var($theme, 'item-title-color-hover'); |
284 | 399 | } |
285 | 400 |
|
286 | 401 | %igx-list__item-line-subtitle { |
287 | 402 | color: --var($theme, 'item-subtitle-color-hover'); |
288 | 403 | } |
289 | 404 |
|
290 | 405 | %igx-list__item-actions { |
291 | | - color: --var($theme, 'item-text-color-hover'); |
| 406 | + color: --var($theme, 'item-action-color-hover'); |
| 407 | + |
| 408 | + %igx-icon-display { |
| 409 | + color: --var($theme, 'item-action-color-hover') |
| 410 | + } |
| 411 | + } |
| 412 | + |
| 413 | + %igx-list__item-thumbnail { |
| 414 | + color: --var($theme, 'item-thumbnail-color-hover'); |
292 | 415 |
|
293 | 416 | %igx-icon-display { |
294 | | - color: --var($theme, 'item-text-color-hover') |
| 417 | + color: --var($theme, 'item-thumbnail-color-hover') |
295 | 418 | } |
296 | 419 | } |
297 | 420 | } |
|
305 | 428 | padding: map-get($list-item-padding, 'cosy'); |
306 | 429 | } |
307 | 430 |
|
308 | | - %igx-list__item-line-title { |
309 | | - color: --var($theme, 'item-text-color') |
310 | | - } |
311 | | - |
312 | 431 | %igx-list__item-thumbnail { |
313 | 432 | display: flex; |
314 | 433 | align-items: center; |
315 | 434 | justify-content: center; |
316 | 435 | align-self: flex-start; |
317 | 436 | padding: 0; |
| 437 | + color: --var($theme, 'item-thumbnail-color'); |
318 | 438 |
|
319 | 439 | > %igx-icon-display { |
320 | 440 | margin: map-get($list-icon-margin, 'comfortable'); |
|
355 | 475 | } |
356 | 476 | } |
357 | 477 |
|
358 | | - %igx-list__item-actions { |
359 | | - display: flex; |
360 | | - align-items: center; |
361 | | - justify-content: center; |
362 | | - color: --var($theme, 'item-text-color'); |
363 | | - |
364 | | - > * { |
365 | | - margin-left: rem(8px); |
366 | | - } |
367 | | - |
368 | | - &:empty { |
369 | | - display: none; |
370 | | - } |
371 | | - |
372 | | - %igx-icon-display { |
373 | | - color: --var($theme, 'item-text-color') |
374 | | - } |
375 | | - } |
376 | | - |
377 | 478 | %igx-list__item-actions--cosy { |
378 | 479 | > * { |
379 | 480 | margin-left: rem(6px); |
|
386 | 487 | } |
387 | 488 | } |
388 | 489 |
|
389 | | - %igx-list__item-lines { |
390 | | - color: --var($theme, 'item-text-color'); |
391 | | - display: flex; |
392 | | - flex-direction: column; |
393 | | - flex: 1 0 0%; |
394 | | - |
395 | | - &:empty { |
396 | | - display: none; |
397 | | - } |
398 | | - } |
399 | | - |
400 | 490 | %igx-list__item-lines + %igx-list__item-actions { |
401 | 491 | margin-left: rem(8px); |
402 | 492 | } |
403 | 493 |
|
404 | 494 | %igx-list-item-content--active { |
405 | 495 | %igx-list__item-line-title { |
406 | | - color: --var($theme, 'item-text-color-active') |
| 496 | + color: --var($theme, 'item-title-color-active') |
407 | 497 | } |
408 | 498 |
|
409 | 499 | %igx-list__item-line-subtitle { |
410 | 500 | color: --var($theme, 'item-subtitle-color-active') |
411 | 501 | } |
412 | 502 |
|
413 | 503 | %igx-list__item-actions { |
414 | | - color: --var($theme, 'item-text-color-active'); |
| 504 | + color: --var($theme, 'item-action-color-active'); |
| 505 | + |
| 506 | + %igx-icon-display { |
| 507 | + color: --var($theme, 'item-action-color-active') |
| 508 | + } |
| 509 | + } |
| 510 | + |
| 511 | + %igx-list__item-thumbnail { |
| 512 | + color: --var($theme, 'item-thumbnail-color-active'); |
415 | 513 |
|
416 | 514 | %igx-icon-display { |
417 | | - color: --var($theme, 'item-text-color-active') |
| 515 | + color: --var($theme, 'item-thumbnail-color-active') |
418 | 516 | } |
419 | 517 | } |
420 | 518 |
|
|
0 commit comments