igniteui-theming 18.0.0 → 18.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sass/bem/_index.scss +139 -31
- package/sass/color/_functions.scss +75 -32
- package/sass/color/_mixins.scss +8 -1
- package/sass/color/_types.scss +7 -3
- package/sass/elevations/_functions.scss +12 -7
- package/sass/elevations/presets/_indigo.scss +1 -7
- package/sass/elevations/presets/_material.scss +1 -5
- package/sass/themes/charts/_category-chart-theme.scss +0 -1
- package/sass/themes/charts/_data-chart-theme.scss +0 -1
- package/sass/themes/charts/_doughnut-chart-theme.scss +0 -1
- package/sass/themes/charts/_financial-chart-theme.scss +0 -1
- package/sass/themes/charts/_funnel-chart-theme.scss +0 -1
- package/sass/themes/charts/_gauge-theme.scss +0 -2
- package/sass/themes/charts/_geo-map-theme.scss +0 -1
- package/sass/themes/charts/_graph-theme.scss +0 -1
- package/sass/themes/charts/_pie-chart-theme.scss +0 -1
- package/sass/themes/charts/_shape-chart-theme.scss +0 -1
- package/sass/themes/charts/_sparkline-theme.scss +0 -1
- package/sass/themes/schemas/charts/dark/_index.scss +0 -18
- package/sass/themes/schemas/charts/light/_data-chart.scss +32 -31
- package/sass/themes/schemas/charts/light/_index.scss +0 -18
- package/sass/themes/schemas/components/dark/_scrollbar.scss +0 -1
- package/sass/themes/schemas/components/dark/_tabs.scss +8 -0
- package/sass/themes/schemas/components/dark/_validator.scss +8 -1
- package/sass/themes/schemas/components/dark/calendar/_days-view.scss +0 -1
- package/sass/themes/schemas/components/dark/calendar/_year-month-view.scss +0 -1
- package/sass/themes/schemas/components/light/_tabs.scss +10 -2
- package/sass/themes/schemas/components/light/calendar/_base.scss +0 -1
- package/sass/typography/_functions.scss +22 -4
- package/sass/typography/_mixins.scss +14 -2
- package/sass/typography/_types.scss +3 -3
- package/sass/utils/_css.scss +1 -0
- package/sass/utils/_map.scss +2 -3
- package/sass/utils/_math.scss +2 -2
- package/sass/utils/_meta.scss +3 -2
- package/sass/utils/_string.scss +1 -0
package/package.json
CHANGED
package/sass/bem/_index.scss
CHANGED
|
@@ -14,19 +14,53 @@
|
|
|
14
14
|
////
|
|
15
15
|
|
|
16
16
|
/// @type String - The Element separator used. Default '__'.
|
|
17
|
-
/// @access
|
|
17
|
+
/// @access public
|
|
18
|
+
/// @example scss - Change the element separator from '__' to '-'
|
|
19
|
+
/// $bem--sep-elem: '-';
|
|
20
|
+
///
|
|
21
|
+
/// @include b(block) {
|
|
22
|
+
/// @include e(element) {
|
|
23
|
+
/// background: blue;
|
|
24
|
+
/// }
|
|
25
|
+
/// }
|
|
26
|
+
///
|
|
27
|
+
/// // Generated CSS
|
|
28
|
+
/// .block-element { background: blue; }
|
|
18
29
|
$bem--sep-elem: if(meta.variable-exists(bem--sep-elem), $bem--sep-elem, '__');
|
|
19
30
|
|
|
20
31
|
/// @type String - The Modifier separator used. Default '--'.
|
|
21
|
-
/// @access
|
|
32
|
+
/// @access public
|
|
33
|
+
/// @example scss - Change the modifier separator from '--' to '---'
|
|
34
|
+
/// $bem--sep-mod: '---';
|
|
35
|
+
///
|
|
36
|
+
/// @include b(block) {
|
|
37
|
+
/// @include m(modifier) {
|
|
38
|
+
/// background: red;
|
|
39
|
+
/// }
|
|
40
|
+
/// }
|
|
41
|
+
///
|
|
42
|
+
/// // Generated CSS
|
|
43
|
+
/// .block---modifier { background: red; }
|
|
22
44
|
$bem--sep-mod: if(meta.variable-exists(bem--sep-mod), $bem--sep-mod, '--');
|
|
23
45
|
|
|
24
46
|
/// @type String - The Modifier Value separator used. Default '-'.
|
|
25
|
-
/// @access
|
|
47
|
+
/// @access public
|
|
48
|
+
/// @example scss - Change the modifier value separator from '-' to '_'
|
|
49
|
+
/// $bem--sep-mod-val: '_';
|
|
50
|
+
///
|
|
51
|
+
/// @include b(block) {
|
|
52
|
+
/// @include m(modifier, value) {
|
|
53
|
+
/// background: red;
|
|
54
|
+
/// }
|
|
55
|
+
/// }
|
|
56
|
+
///
|
|
57
|
+
/// // Generated CSS
|
|
58
|
+
/// .block--modifier_value { background: red; }
|
|
26
59
|
$bem--sep-mod-val: if(meta.variable-exists(bem--sep-mod-val), $bem--sep-mod-val, '-');
|
|
27
60
|
|
|
28
61
|
/// Cache for modifier string conversions
|
|
29
62
|
/// @type Map
|
|
63
|
+
/// @access private
|
|
30
64
|
$_bem-mod-cache: () !default;
|
|
31
65
|
|
|
32
66
|
/// Converts a passed selector value into plain string.
|
|
@@ -190,23 +224,31 @@ $_bem-mod-cache: () !default;
|
|
|
190
224
|
}
|
|
191
225
|
|
|
192
226
|
/// Generates a full BEM selector.
|
|
193
|
-
/// @access
|
|
194
|
-
/// @param {String} $block -
|
|
195
|
-
/// @param {String|List} $elem -
|
|
227
|
+
/// @access public
|
|
228
|
+
/// @param {String} $block - A string block name. Required.
|
|
229
|
+
/// @param {String|List} $elem [null] - A sub-element name. If `$mod` is not present, it is
|
|
196
230
|
/// joined with $block. If $mod is present, it is nested under `$block--$mod`.
|
|
197
|
-
/// @param {String|Map} $mod -
|
|
231
|
+
/// @param {String|Map} $mod [null] - A block modifier.
|
|
232
|
+
/// @param {List} $mods [null] - A list of block modifiers.
|
|
233
|
+
///
|
|
198
234
|
/// @example scss Include a block
|
|
199
|
-
///
|
|
235
|
+
/// $selector: bem-selector(block); // returns .block
|
|
236
|
+
///
|
|
200
237
|
/// @example scss Include a block and an element
|
|
201
|
-
///
|
|
238
|
+
/// $selector: bem-selector(block, $elem: elem); // returns .block__elem
|
|
239
|
+
///
|
|
202
240
|
/// @example scss Include block, element, and element modifier
|
|
203
|
-
///
|
|
241
|
+
/// $selector: bem-selector(block, $elem: (elem, mod); // returns .block__elem--mod
|
|
242
|
+
///
|
|
204
243
|
/// @example scss Include block and block modifier
|
|
205
|
-
///
|
|
206
|
-
///
|
|
207
|
-
///
|
|
244
|
+
/// $selector: bem-selector(block, $mod: mod) // returns .block--mod
|
|
245
|
+
///
|
|
246
|
+
/// @example scss Include block and multiple block modifiers
|
|
247
|
+
/// $selector: bem-selector(block, $mods: (mod-1, mod-2)) // returns .block--mod-1.block--mod-2
|
|
248
|
+
///
|
|
208
249
|
/// @example scss Include block modifier followed by block sub-element
|
|
209
|
-
///
|
|
250
|
+
/// $selector: bem-selector(block, $m: mod, $e: elem); // returns .block--mod .block__elem
|
|
251
|
+
///
|
|
210
252
|
/// @return {String} The generated BEM selector string
|
|
211
253
|
@function bem-selector($block, $e: null, $elem: null, $m: null, $mod: null, $mods: null) {
|
|
212
254
|
$block: bem--with-dot($block);
|
|
@@ -284,11 +326,11 @@ $_bem-mod-cache: () !default;
|
|
|
284
326
|
/// @access public
|
|
285
327
|
/// @param {String} $block - The block name.
|
|
286
328
|
/// @param {String} $elem - The element name.
|
|
287
|
-
/// @param {String} $mod -
|
|
329
|
+
/// @param {String} $mod [null] - The modifier name. Optional.
|
|
288
330
|
/// @return {String} The BEM element selector string.
|
|
289
331
|
/// @example scss
|
|
290
|
-
/// elem('button', 'icon')
|
|
291
|
-
/// elem('button', 'icon', 'big') // returns '.button__icon--big'
|
|
332
|
+
/// $selector: elem('button', 'icon') // returns '.button__icon'
|
|
333
|
+
/// $selector: elem('button', 'icon', 'big') // returns '.button__icon--big'
|
|
292
334
|
@function elem($block, $elem, $mod: null) {
|
|
293
335
|
@if not meta.type-of($block) == 'string' {
|
|
294
336
|
@error 'Block must be a string, got #{meta.type-of($block)}';
|
|
@@ -315,21 +357,22 @@ $_bem-mod-cache: () !default;
|
|
|
315
357
|
/// @param {String} $mod - The modifier name.
|
|
316
358
|
/// @return {String} The BEM modifier selector string.
|
|
317
359
|
/// @example scss
|
|
318
|
-
/// mod('button', 'primary') // returns '.button--primary'
|
|
319
|
-
/// mod('card', 'outlined') // returns '.card--outlined'
|
|
360
|
+
/// $selector: mod('button', 'primary') // returns '.button--primary'
|
|
361
|
+
/// $selector: mod('card', 'outlined') // returns '.card--outlined'
|
|
320
362
|
@function mod($block, $mod) {
|
|
321
363
|
@return bem-selector($block, $m: $mod);
|
|
322
364
|
}
|
|
323
365
|
|
|
324
366
|
/// Simply unrolls into a class-selector. The main purpose of using this mixin
|
|
325
367
|
/// is to clearly denote the start of a BEM block.
|
|
326
|
-
/// @access public
|
|
368
|
+
/// @access public
|
|
327
369
|
/// @param {String} $block - The block name.
|
|
328
370
|
/// @example
|
|
329
371
|
/// @include bem-block(block) {
|
|
330
372
|
/// background: green;
|
|
331
373
|
/// }
|
|
332
|
-
///
|
|
374
|
+
///
|
|
375
|
+
/// // Output
|
|
333
376
|
/// .block { background: green; }
|
|
334
377
|
@mixin bem-block($block) {
|
|
335
378
|
@at-root {
|
|
@@ -523,72 +566,137 @@ $_bem-mod-cache: () !default;
|
|
|
523
566
|
}
|
|
524
567
|
}
|
|
525
568
|
|
|
526
|
-
///
|
|
527
|
-
/// @
|
|
569
|
+
/// Generates a full BEM rule.
|
|
570
|
+
/// @access public
|
|
571
|
+
/// @param {String} $block - A string block name. Required.
|
|
572
|
+
/// @param {String|List} $elem [null] - A sub-element name. If `$mod` is not present, it is
|
|
573
|
+
/// joined with $block. If $mod is present, it is nested under `$block--$mod`.
|
|
574
|
+
/// @param {String|Map} $mod [null] - A block modifier.
|
|
575
|
+
/// @param {String|Map} $mods [null] - A list of block modifiers.
|
|
576
|
+
///
|
|
577
|
+
/// @example scss - Include a block
|
|
578
|
+
/// @include bem(block) {
|
|
579
|
+
/// background: blue;
|
|
580
|
+
/// };
|
|
581
|
+
///
|
|
582
|
+
/// // Output
|
|
583
|
+
/// .block {
|
|
584
|
+
/// background: blue;
|
|
585
|
+
/// }
|
|
586
|
+
///
|
|
587
|
+
/// @example scss - Include a block and an element
|
|
588
|
+
/// @include bem(block, $elem: elem) {
|
|
589
|
+
/// background: blue;
|
|
590
|
+
/// }
|
|
591
|
+
///
|
|
592
|
+
/// // Output
|
|
593
|
+
/// .block__elem {
|
|
594
|
+
/// background: blue;
|
|
595
|
+
/// }
|
|
596
|
+
///
|
|
597
|
+
/// @example scss - Include block, element, and element modifier
|
|
598
|
+
/// @include bem(block, $elem: (elem, mod)) {
|
|
599
|
+
/// background: blue;
|
|
600
|
+
/// }
|
|
601
|
+
///
|
|
602
|
+
/// // Output
|
|
603
|
+
/// .block__elem--mod {
|
|
604
|
+
/// background: blue;
|
|
605
|
+
/// }
|
|
606
|
+
///
|
|
607
|
+
/// @example scss - Include block and block modifier
|
|
608
|
+
/// @include bem(block, $mod: mod) {
|
|
609
|
+
/// background: blue;
|
|
610
|
+
/// }
|
|
611
|
+
///
|
|
612
|
+
/// // Output
|
|
613
|
+
/// .block--mod {
|
|
614
|
+
/// background: blue;
|
|
615
|
+
/// }
|
|
616
|
+
///
|
|
617
|
+
/// @example scss - Include block with multiple modifiers
|
|
618
|
+
/// @include bem(block, $mods: (mod-1, mod-2)) {
|
|
619
|
+
/// background: blue;
|
|
620
|
+
/// }
|
|
621
|
+
///
|
|
622
|
+
/// // Output
|
|
623
|
+
/// .block--mod-1.block--mod-2 {
|
|
624
|
+
/// background: blue;
|
|
625
|
+
/// }
|
|
626
|
+
///
|
|
627
|
+
/// @example scss - Include block modifier followed by block sub-element
|
|
628
|
+
/// @include bem(block, $m:mod, $e:elem) {
|
|
629
|
+
/// background: blue;
|
|
630
|
+
/// }
|
|
631
|
+
///
|
|
632
|
+
/// // Output
|
|
633
|
+
/// .block--mod .block__elem {
|
|
634
|
+
/// background: blue;
|
|
635
|
+
/// }
|
|
528
636
|
@mixin bem($block, $e: null, $elem: null, $m: null, $mod: null, $mods: null) {
|
|
529
637
|
#{bem-selector($block, $e: $e, $elem: $elem, $m: $m, $mod: $mod, $mods: $mods)} {
|
|
530
638
|
@content;
|
|
531
639
|
}
|
|
532
640
|
}
|
|
533
641
|
|
|
642
|
+
/// The same as bem-block.
|
|
534
643
|
/// @alias bem-block
|
|
535
|
-
/// @see bem-block
|
|
536
644
|
@mixin block($block) {
|
|
537
645
|
@include bem-block($block) {
|
|
538
646
|
@content;
|
|
539
647
|
}
|
|
540
648
|
}
|
|
541
649
|
|
|
650
|
+
/// The same as bem-elem.
|
|
542
651
|
/// @alias bem-elem
|
|
543
|
-
/// @see bem-elem
|
|
544
652
|
@mixin elem($elem, $m: null, $mod: null, $mods: null, $not: null) {
|
|
545
653
|
@include bem-elem($elem, $m: $m, $mod: $mod, $mods: $mods, $not: $not) {
|
|
546
654
|
@content;
|
|
547
655
|
}
|
|
548
656
|
}
|
|
549
657
|
|
|
658
|
+
/// The same as bem-mod.
|
|
550
659
|
/// @alias bem-mod
|
|
551
|
-
/// @see bem-mod
|
|
552
660
|
@mixin mod($mod, $not: null) {
|
|
553
661
|
@include bem-mod($mod, $not) {
|
|
554
662
|
@content;
|
|
555
663
|
}
|
|
556
664
|
}
|
|
557
665
|
|
|
666
|
+
/// The same as bem-mods.
|
|
558
667
|
/// @alias bem-mods
|
|
559
|
-
/// @see bem-mods
|
|
560
668
|
@mixin mods($mods...) {
|
|
561
669
|
@include bem-mods($mods...) {
|
|
562
670
|
@content;
|
|
563
671
|
}
|
|
564
672
|
}
|
|
565
673
|
|
|
674
|
+
/// The same as bem-block.
|
|
566
675
|
/// @alias bem-block
|
|
567
|
-
/// @see bem-block
|
|
568
676
|
@mixin b($block) {
|
|
569
677
|
@include bem-block($block) {
|
|
570
678
|
@content;
|
|
571
679
|
}
|
|
572
680
|
}
|
|
573
681
|
|
|
682
|
+
/// The same as bem-elem.
|
|
574
683
|
/// @alias bem-elem
|
|
575
|
-
/// @see bem-elem
|
|
576
684
|
@mixin e($elem, $m: null, $mod: null, $mods: null, $not: null) {
|
|
577
685
|
@include bem-elem($elem, $m: $m, $mod: $mod, $mods: $mods, $not: $not) {
|
|
578
686
|
@content;
|
|
579
687
|
}
|
|
580
688
|
}
|
|
581
689
|
|
|
690
|
+
/// The same as bem-mod.
|
|
582
691
|
/// @alias bem-mod
|
|
583
|
-
/// @see bem-mod
|
|
584
692
|
@mixin m($mod, $not: null) {
|
|
585
693
|
@include bem-mod($mod, $not) {
|
|
586
694
|
@content;
|
|
587
695
|
}
|
|
588
696
|
}
|
|
589
697
|
|
|
698
|
+
/// The same as bem-mods.
|
|
590
699
|
/// @alias bem-mods
|
|
591
|
-
/// @see bem-mods
|
|
592
700
|
@mixin mx($mods...) {
|
|
593
701
|
@include bem-mods($mods...) {
|
|
594
702
|
@content;
|
|
@@ -18,11 +18,12 @@ $_enhanced-accessibility: false;
|
|
|
18
18
|
/// Configures the color module.
|
|
19
19
|
/// @access public
|
|
20
20
|
/// @group color
|
|
21
|
-
/// @param {Boolean} $enhanced-accessibility [null] - Enables features like color blind
|
|
21
|
+
/// @param {Boolean} $enhanced-accessibility [null] - Enables features like color blind brushes for chart themes.
|
|
22
22
|
/// @example scss
|
|
23
23
|
/// .enhanced-accessibility {
|
|
24
24
|
/// @include configure-colors(true);
|
|
25
25
|
/// }
|
|
26
|
+
/// @see $brushes-color-blind
|
|
26
27
|
@mixin configure-colors($enhanced-accessibility: null) {
|
|
27
28
|
@if $enhanced-accessibility {
|
|
28
29
|
$_enhanced-accessibility: $enhanced-accessibility !global;
|
|
@@ -44,8 +45,15 @@ $_enhanced-accessibility: false;
|
|
|
44
45
|
/// @requires {function} shades
|
|
45
46
|
/// @returns {Map} - A map consisting of color shades for the passed base colors (primary, secondary, gray, etc).
|
|
46
47
|
/// @example scss
|
|
47
|
-
/// //
|
|
48
|
-
/// $my-palette: palette(
|
|
48
|
+
/// // Pass the required colors
|
|
49
|
+
/// $my-palette: palette(
|
|
50
|
+
/// $primary: rebeccapurple,
|
|
51
|
+
/// $secondary: orange,
|
|
52
|
+
/// $surface: white,
|
|
53
|
+
/// );
|
|
54
|
+
///
|
|
55
|
+
/// // Include the generated palette colors as CSS variables.
|
|
56
|
+
/// @include palette($my-palette);
|
|
49
57
|
@function palette(
|
|
50
58
|
$primary,
|
|
51
59
|
$secondary,
|
|
@@ -83,18 +91,26 @@ $_enhanced-accessibility: false;
|
|
|
83
91
|
);
|
|
84
92
|
}
|
|
85
93
|
|
|
86
|
-
/// Generates
|
|
94
|
+
/// Generates color shades for a given color.
|
|
87
95
|
/// @access public
|
|
88
96
|
/// @group Palettes
|
|
89
97
|
/// @param {String} $name - The name of the color.
|
|
90
|
-
/// @param {Color} $color - The base color used to generate the
|
|
91
|
-
/// @param {List} $shades - The list of
|
|
92
|
-
/// @param {Color} $surface [null] - The surface color. Useful
|
|
93
|
-
/// @requires {function}
|
|
94
|
-
/// @
|
|
95
|
-
///
|
|
98
|
+
/// @param {Color} $color - The base color used to generate the shades.
|
|
99
|
+
/// @param {List} $shades - The list of shade variants.
|
|
100
|
+
/// @param {Color} $surface [null] - The surface color. Useful if generating shades of gray (optional).
|
|
101
|
+
/// @requires {function} adaptive-contrast
|
|
102
|
+
/// @returns {Map} - A map consisting of color shades and their respective contrast colors.
|
|
103
|
+
///
|
|
96
104
|
/// @example scss
|
|
97
|
-
/// $
|
|
105
|
+
/// $color-name: 'accent';
|
|
106
|
+
///
|
|
107
|
+
/// // Include the generated palette colors as CSS variables.
|
|
108
|
+
/// @include palette(
|
|
109
|
+
/// (
|
|
110
|
+
/// #{$color-name}: shades($color-name, #a57865, $IColorShades),
|
|
111
|
+
/// )
|
|
112
|
+
/// );
|
|
113
|
+
/// @see $IColorShades
|
|
98
114
|
@function shades($name, $color, $shades, $surface: null) {
|
|
99
115
|
$result: ();
|
|
100
116
|
|
|
@@ -161,9 +177,6 @@ $_enhanced-accessibility: false;
|
|
|
161
177
|
}
|
|
162
178
|
}
|
|
163
179
|
|
|
164
|
-
// $special-color-shades: shades('accent', #09f, (50,100,200,300,400,500,600,700,800,900));
|
|
165
|
-
// @debug $special-color-shades;
|
|
166
|
-
|
|
167
180
|
/// Retrieves a color from a color palette.
|
|
168
181
|
/// @access public
|
|
169
182
|
/// @group Palettes
|
|
@@ -172,14 +185,26 @@ $_enhanced-accessibility: false;
|
|
|
172
185
|
/// @param {Number | String} $variant [500] - The target color shade from the color palette.
|
|
173
186
|
/// @param {Number} $opacity [null] - Optional opacity to apply to the color shade.
|
|
174
187
|
/// @returns {Color | String} - The raw color shade or CSS variable reference from the palette.
|
|
175
|
-
///
|
|
176
|
-
///
|
|
188
|
+
///
|
|
189
|
+
/// @example scss - Getting a color from the palette
|
|
190
|
+
/// // Without providing a palette
|
|
177
191
|
/// .my-component-1 {
|
|
178
|
-
/// background: color($color:
|
|
192
|
+
/// background: color($color: primary, $variant: 200); // var(--ig-primary-200)
|
|
179
193
|
/// }
|
|
180
|
-
///
|
|
194
|
+
///
|
|
195
|
+
/// // With a specific palette
|
|
181
196
|
/// .my-component-2 {
|
|
182
|
-
/// background: color($my-palette,
|
|
197
|
+
/// background: color($my-palette, primary, 200); // #88c0e5
|
|
198
|
+
/// }
|
|
199
|
+
///
|
|
200
|
+
/// @example scss - Getting a color with opacity
|
|
201
|
+
/// .my-component-1 {
|
|
202
|
+
/// background: color($color: primary, $variant: 200, $opacity: 0.5); // hsl(from var(--ig-primary-200) h s l/0.5)
|
|
203
|
+
/// }
|
|
204
|
+
///
|
|
205
|
+
/// // With a specific palette
|
|
206
|
+
/// .my-component-2 {
|
|
207
|
+
/// background: color($my-palette, primary, 200, $opacity: 0.5); // rgba(136, 192, 229, 0.5)
|
|
183
208
|
/// }
|
|
184
209
|
@function color($palette: null, $color: primary, $variant: 500, $opacity: null) {
|
|
185
210
|
$s: #{var(--ig-#{$color}-#{$variant})};
|
|
@@ -198,7 +223,7 @@ $_enhanced-accessibility: false;
|
|
|
198
223
|
@return $_relative-color;
|
|
199
224
|
}
|
|
200
225
|
|
|
201
|
-
/// Retrieves a contrast
|
|
226
|
+
/// Retrieves a contrast color for a given color variant from a color palette. Works similarly to the color function.
|
|
202
227
|
/// @access public
|
|
203
228
|
/// @group Palettes
|
|
204
229
|
/// @param {Map} $palette [null] - The source palette map (optional).
|
|
@@ -207,11 +232,13 @@ $_enhanced-accessibility: false;
|
|
|
207
232
|
/// @param {Number} $opacity [null] - Optional opacity to apply to the color shade.
|
|
208
233
|
/// @requires {function} color
|
|
209
234
|
/// @returns {Color | String} - The raw contrast color shade or CSS variable from the palette.
|
|
235
|
+
///
|
|
210
236
|
/// @example scss without passing a palette
|
|
211
237
|
/// .my-component {
|
|
212
238
|
/// background: color($color: 'primary', $variant: 200);
|
|
213
239
|
/// color: contrast-color($color: 'primary', $variant: 200);
|
|
214
240
|
/// }
|
|
241
|
+
///
|
|
215
242
|
@function contrast-color($palette: null, $color: primary, $variant: 500, $opacity: null) {
|
|
216
243
|
@return color($palette, $color, #{$variant}-contrast, $opacity);
|
|
217
244
|
}
|
|
@@ -220,13 +247,14 @@ $_enhanced-accessibility: false;
|
|
|
220
247
|
/// @access public
|
|
221
248
|
/// @group Color
|
|
222
249
|
/// @param {Color} $color - The base color used in the calculation.
|
|
223
|
-
/// @returns {string} - Returns a relative
|
|
250
|
+
/// @returns {string} - Returns a relative HSL color where the lightness is adjusted
|
|
224
251
|
/// based on the specified contrast level, resulting in either black or white.
|
|
252
|
+
///
|
|
225
253
|
/// @example scss
|
|
226
254
|
/// .my-component {
|
|
227
255
|
/// --bg: #09f;
|
|
228
256
|
/// background: var(--bg);
|
|
229
|
-
/// color: adaptive-contrast(var(--bg));
|
|
257
|
+
/// color: adaptive-contrast(var(--bg)); // hsl(from color(from var(--bg) var(--y-contrast)) h 0 l)
|
|
230
258
|
/// }
|
|
231
259
|
@function adaptive-contrast($color) {
|
|
232
260
|
$fn: meta.get-function('color', $css: true);
|
|
@@ -235,6 +263,7 @@ $_enhanced-accessibility: false;
|
|
|
235
263
|
}
|
|
236
264
|
|
|
237
265
|
/// Returns a contrast color for a passed color.
|
|
266
|
+
/// @deprecated Use adaptive-contrast instead.
|
|
238
267
|
/// @access public
|
|
239
268
|
/// @group Color
|
|
240
269
|
/// @param {Color} $background - The background color used to return a contrast/forground color for.
|
|
@@ -244,12 +273,15 @@ $_enhanced-accessibility: false;
|
|
|
244
273
|
/// @require {function} contrast
|
|
245
274
|
/// @returns {Color} - Returns either white, black, or the provided foreground
|
|
246
275
|
/// color if it meets the required contrast level.
|
|
247
|
-
///
|
|
276
|
+
///
|
|
248
277
|
/// @example scss
|
|
249
278
|
/// .my-component {
|
|
250
|
-
/// background: #09f
|
|
251
|
-
/// color: text-contrast(#09f)
|
|
279
|
+
/// background: #09f;
|
|
280
|
+
/// color: text-contrast(#09f);
|
|
252
281
|
/// }
|
|
282
|
+
///
|
|
283
|
+
/// @see {function} adaptive-contrast
|
|
284
|
+
/// @link https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html WCAG 2.0 Contrast
|
|
253
285
|
@function text-contrast($background, $foreground: white, $contrast: 'AAA') {
|
|
254
286
|
@if meta.type-of($foreground) != 'list' and meta.type-of($background) != 'color' {
|
|
255
287
|
@return $background;
|
|
@@ -295,6 +327,7 @@ $_enhanced-accessibility: false;
|
|
|
295
327
|
}
|
|
296
328
|
|
|
297
329
|
/// Mixes two colors to produce an opaque color.
|
|
330
|
+
/// @deprecated Switch to CSS color-mix.
|
|
298
331
|
/// @access private
|
|
299
332
|
/// @group Color
|
|
300
333
|
/// @param {Color} $color-1 - The first color, usually transparent.
|
|
@@ -317,6 +350,7 @@ $_enhanced-accessibility: false;
|
|
|
317
350
|
}
|
|
318
351
|
|
|
319
352
|
/// Retruns a comma separated list of hue, saturation, and lightness values for a given color.
|
|
353
|
+
/// @deprecated Not needed anymore and will be removed in the future.
|
|
320
354
|
/// @access public
|
|
321
355
|
/// @group Color
|
|
322
356
|
/// @param {Color} $color - The color to be converted to an HSL list of values.
|
|
@@ -328,16 +362,18 @@ $_enhanced-accessibility: false;
|
|
|
328
362
|
}
|
|
329
363
|
|
|
330
364
|
/// Calculates the contrast ratio between two colors.
|
|
331
|
-
/// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
|
|
332
365
|
/// @access public
|
|
333
366
|
/// @group Color
|
|
334
367
|
/// @param {Color} $background - The background color.
|
|
335
368
|
/// @param {Color} $foreground - The foreground color.
|
|
336
|
-
///
|
|
337
|
-
/// @require {function} to-fixed
|
|
369
|
+
///
|
|
338
370
|
/// @example scss
|
|
339
|
-
/// contrast(#09f, #000);
|
|
371
|
+
/// $conrast: contrast(#09f, #000); // 7
|
|
372
|
+
///
|
|
340
373
|
/// @returns {Number} - The contrast ratio between the background and foreground colors.
|
|
374
|
+
/// @require {function} luminance
|
|
375
|
+
/// @require {function} to-fixed
|
|
376
|
+
/// @link https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests WCAG 2.0 Contrast Ratio
|
|
341
377
|
@function contrast($background, $foreground) {
|
|
342
378
|
$backLum: luminance($background) + 0.05;
|
|
343
379
|
$foreLum: luminance($foreground) + 0.05;
|
|
@@ -346,13 +382,17 @@ $_enhanced-accessibility: false;
|
|
|
346
382
|
}
|
|
347
383
|
|
|
348
384
|
/// Calculates the luminance for a given color.
|
|
349
|
-
/// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests.
|
|
350
385
|
/// @access public
|
|
351
386
|
/// @group Color
|
|
352
387
|
/// @param {Color} $color - The color to calculate luminance for.
|
|
388
|
+
///
|
|
353
389
|
/// @example scss
|
|
354
|
-
/// luminance(#
|
|
390
|
+
/// $white: luminance(#fff); // 1
|
|
391
|
+
/// $blue: luminance(#09f); // 0.3
|
|
392
|
+
/// $black: luminance(#000); // 0
|
|
393
|
+
///
|
|
355
394
|
/// @returns {Number | String} - The calculated luminance of a given color
|
|
395
|
+
/// @link https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests. WCAG 2.0 Contrast Ratio
|
|
356
396
|
@function luminance($color) {
|
|
357
397
|
@if meta.type-of($color) == 'color' {
|
|
358
398
|
$r: math.div(color.red($color), 255);
|
|
@@ -375,10 +415,13 @@ $_enhanced-accessibility: false;
|
|
|
375
415
|
@return if($value < 0.03928, math.div($value, 12.92), math.pow(math.div($value + 0.055, 1.055), 2.4));
|
|
376
416
|
}
|
|
377
417
|
|
|
378
|
-
/// Returns a list of colors to be used as chart brushes.
|
|
418
|
+
/// Returns a list of colors to be used as chart brushes. The return value depends on the value of enhanced-accessibility.
|
|
379
419
|
/// @access public
|
|
380
420
|
/// @group Palettes
|
|
381
421
|
/// @returns { List } - A list of colors to be used as chart brushes.
|
|
422
|
+
/// @see {mixin} configure-colors
|
|
423
|
+
/// @see $brushes-regular
|
|
424
|
+
/// @see $brushes-color-blind
|
|
382
425
|
@function chart-brushes() {
|
|
383
426
|
@return if($_enhanced-accessibility, charts.$brushes-color-blind, charts.$brushes-regular);
|
|
384
427
|
}
|
package/sass/color/_mixins.scss
CHANGED
|
@@ -30,19 +30,22 @@ $_added: () !default;
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/// Sets up CSS custom properties for WCAG contrast calculations.
|
|
33
|
-
/// These properties are used to determine the appropriate text color
|
|
33
|
+
/// These properties are used to determine the appropriate text contrast color
|
|
34
34
|
/// based on WCAG accessibility guidelines.
|
|
35
35
|
/// @access public
|
|
36
36
|
/// @group Color
|
|
37
37
|
/// @param {String} $level ['aa'] - WCAG contrast level ('a', 'aa', or 'aaa')
|
|
38
|
+
///
|
|
38
39
|
/// @example scss - Using the mixin with default AA level
|
|
39
40
|
/// .my-component {
|
|
40
41
|
/// @include adaptive-contrast();
|
|
41
42
|
/// }
|
|
43
|
+
///
|
|
42
44
|
/// @example scss - Using the mixin with AAA level
|
|
43
45
|
/// .my-component {
|
|
44
46
|
/// @include adaptive-contrast('aaa');
|
|
45
47
|
/// }
|
|
48
|
+
///
|
|
46
49
|
/// @example scss - Generated CSS custom properties
|
|
47
50
|
/// :root {
|
|
48
51
|
/// --ig-wcag-a: 0.31; // Level A threshold
|
|
@@ -70,10 +73,14 @@ $_added: () !default;
|
|
|
70
73
|
/// @group Palettes
|
|
71
74
|
/// @param {Map} $palette - The palette used to generate CSS variables.
|
|
72
75
|
/// @param {Boolean} $contrast [true] - Specify if contrast colors should be included.
|
|
76
|
+
///
|
|
73
77
|
/// @example scss Generate css variables for a palette
|
|
74
78
|
/// $palette: palette($primary: red, $secondary: blue, $gray: #000);
|
|
75
79
|
/// @include palette($palette);
|
|
80
|
+
///
|
|
76
81
|
/// @require {function} is-root
|
|
82
|
+
/// @require {function} to-string
|
|
83
|
+
/// @require {mixin} adaptive-contrast
|
|
77
84
|
@mixin palette($palette, $contrast: true, $contrast-level: 'aa') {
|
|
78
85
|
$scope: if(is-root(), ':root', '&');
|
|
79
86
|
|
package/sass/color/_types.scss
CHANGED
|
@@ -8,17 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
/// A list consisting of all generated gray shades
|
|
10
10
|
/// @type Map
|
|
11
|
-
/// @access
|
|
11
|
+
/// @access public
|
|
12
12
|
$IGrayShades: ('50', '100', '200', '300', '400', '500', '600', '700', '800', '900');
|
|
13
13
|
|
|
14
14
|
/// A list consisting of all generated shades for palette colors
|
|
15
15
|
/// @type Map
|
|
16
|
-
/// @access
|
|
16
|
+
/// @access public
|
|
17
|
+
/// @requires $IGrayShades
|
|
17
18
|
$IColorShades: list.join($IGrayShades, ('A100', 'A200', 'A400', 'A700'));
|
|
18
19
|
|
|
19
20
|
/// All palette colors mapped with corresponding color shades
|
|
20
21
|
/// @type Map
|
|
21
|
-
/// @access
|
|
22
|
+
/// @access public
|
|
23
|
+
/// @requires $IColorShades
|
|
24
|
+
/// @requires $IGrayShades
|
|
22
25
|
$IPaletteColors: (
|
|
23
26
|
'primary': $IColorShades,
|
|
24
27
|
'secondary': $IColorShades,
|
|
@@ -40,6 +43,7 @@ $IPaletteMeta: (
|
|
|
40
43
|
/// A map with all palette colors and palette meta
|
|
41
44
|
/// @type Map
|
|
42
45
|
/// @access private
|
|
46
|
+
/// @requires $IPaletteColors
|
|
43
47
|
$IPalette: map.merge(
|
|
44
48
|
$IPaletteColors,
|
|
45
49
|
(
|
|
@@ -53,11 +53,16 @@ $factor: var(--ig-elevation-factor, 1);
|
|
|
53
53
|
/// @access public
|
|
54
54
|
/// @param {List} $shadows - A list of shadow values.
|
|
55
55
|
/// @example scss
|
|
56
|
-
///
|
|
57
|
-
///
|
|
58
|
-
///
|
|
59
|
-
///
|
|
60
|
-
///
|
|
56
|
+
/// .my-component {
|
|
57
|
+
/// box-shadow: box-shadow((0 0 2px 3px black, 0 6px 9px orange));
|
|
58
|
+
/// }
|
|
59
|
+
///
|
|
60
|
+
/// // Output
|
|
61
|
+
/// .my-component {
|
|
62
|
+
/// box-shadow:
|
|
63
|
+
/// 0 0 calc(--ig-elevation-factor * 2px) calc(--ig-elevation-factor * 3px) black,
|
|
64
|
+
/// 0 calc(--ig-elevation-factor * 6px) calc(--ig-elevation-factor * 9px) orange;
|
|
65
|
+
/// }
|
|
61
66
|
/// @return {List} - The transformed shadow list.
|
|
62
67
|
/// @requires {function} _is-shadow
|
|
63
68
|
/// @requires {function} _transform-shadow
|
|
@@ -90,8 +95,8 @@ $factor: var(--ig-elevation-factor, 1);
|
|
|
90
95
|
/// @access public
|
|
91
96
|
/// @param {String} $name - The name of the shadow.
|
|
92
97
|
/// @example scss
|
|
93
|
-
/// .my-
|
|
94
|
-
/// box-shadow: elevation(5);
|
|
98
|
+
/// .my-component {
|
|
99
|
+
/// box-shadow: elevation(5); // var(--ig-elevation-5)
|
|
95
100
|
/// }
|
|
96
101
|
/// @return {String} - The CSS elevation variable
|
|
97
102
|
@function elevation($name) {
|