igniteui-theming 1.0.0-alpha → 1.0.0-beta.11

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.
Files changed (58) hide show
  1. package/.github/workflows/npm-publish.yml +3 -0
  2. package/.stylelintrc.json +83 -0
  3. package/_index.scss +5 -2
  4. package/package.json +12 -4
  5. package/sass/_index.scss +5 -0
  6. package/sass/color/_charts.scss +31 -0
  7. package/sass/color/_functions.scss +350 -0
  8. package/sass/color/_index.scss +5 -0
  9. package/sass/color/_mixins.scss +48 -0
  10. package/sass/color/_multipliers.scss +48 -0
  11. package/sass/color/_types.scss +55 -0
  12. package/sass/color/presets/_index.scss +2 -0
  13. package/sass/color/presets/dark/_bootstrap.scss +13 -0
  14. package/sass/color/presets/dark/_extra.scss +20 -0
  15. package/sass/color/presets/dark/_fluent.scss +29 -0
  16. package/sass/color/presets/dark/_index.scss +5 -0
  17. package/sass/color/presets/dark/_indigo.scss +13 -0
  18. package/sass/color/presets/dark/_material.scss +12 -0
  19. package/sass/color/presets/light/_bootstrap.scss +13 -0
  20. package/sass/color/presets/light/_extra.scss +20 -0
  21. package/sass/color/presets/light/_fluent.scss +30 -0
  22. package/sass/color/presets/light/_index.scss +5 -0
  23. package/sass/color/presets/light/_indigo.scss +13 -0
  24. package/sass/color/presets/light/_material.scss +12 -0
  25. package/sass/elevations/_functions.scss +88 -0
  26. package/sass/elevations/_index.scss +2 -0
  27. package/sass/elevations/_mixins.scss +34 -0
  28. package/sass/elevations/presets/_index.scss +1 -0
  29. package/sass/elevations/presets/_material.scss +63 -0
  30. package/sass/themes/_functions.scss +140 -0
  31. package/sass/themes/_index.scss +2 -0
  32. package/sass/themes/_mixins.scss +126 -0
  33. package/sass/typography/_functions.scss +148 -0
  34. package/sass/typography/_index.scss +3 -0
  35. package/sass/typography/_mixins.scss +102 -0
  36. package/sass/typography/_types.scss +47 -0
  37. package/sass/typography/presets/_bootstrap.scss +139 -0
  38. package/sass/typography/presets/_fluent.scss +125 -0
  39. package/sass/typography/presets/_index.scss +4 -0
  40. package/sass/typography/presets/_indigo.scss +126 -0
  41. package/sass/typography/presets/_material.scss +128 -0
  42. package/sass/utils/_css.scss +32 -0
  43. package/sass/utils/_index.scss +5 -0
  44. package/sass/utils/_map.scss +60 -0
  45. package/sass/utils/_math.scss +43 -0
  46. package/sass/utils/_meta.scss +16 -0
  47. package/sass/utils/_string.scss +75 -0
  48. package/test/_color.spec.scss +251 -0
  49. package/test/_elevations.spec.scss +69 -0
  50. package/test/_index.scss +5 -0
  51. package/test/_themes.spec.scss +284 -0
  52. package/test/_typography.spec.scss +267 -0
  53. package/test/_utils.spec.scss +106 -0
  54. package/test/e2e/theme.scss +7 -0
  55. package/{tests → test}/test.js +0 -0
  56. package/sass/_functions.scss +0 -3
  57. package/sass/_mixins.scss +0 -4
  58. package/tests/_index.scss +0 -8
@@ -21,6 +21,9 @@ jobs:
21
21
  - name: Install dependencies
22
22
  run: npm ci
23
23
 
24
+ - name: Lint package
25
+ run: npm run lint
26
+
24
27
  - name: Test package
25
28
  run: npm test
26
29
 
@@ -0,0 +1,83 @@
1
+ {
2
+ "extends": "stylelint-config-standard-scss",
3
+ "plugins": ["stylelint-scss"],
4
+ "rules": {
5
+ "at-rule-disallowed-list": ["debug", {
6
+ "severity": "warning"
7
+ }],
8
+ "block-closing-brace-empty-line-before": "never",
9
+ "block-closing-brace-newline-after": "always-single-line",
10
+ "block-no-empty": true,
11
+ "color-hex-case": "lower",
12
+ "color-hex-length": "short",
13
+ "color-no-invalid-hex": true,
14
+ "comment-no-empty": true,
15
+ "custom-property-pattern": "(?:igc-)?.+",
16
+ "declaration-block-no-duplicate-properties": true,
17
+ "declaration-block-no-shorthand-property-overrides": true,
18
+ "declaration-block-single-line-max-declarations": 1,
19
+ "declaration-colon-space-after": "always-single-line",
20
+ "font-family-no-duplicate-names": true,
21
+ "font-family-no-missing-generic-family-keyword": true,
22
+ "font-weight-notation": "numeric",
23
+ "function-calc-no-unspaced-operator": true,
24
+ "function-comma-space-after": "always-single-line",
25
+ "indentation": 4,
26
+ "length-zero-no-unit": true,
27
+ "max-nesting-depth": [3, {
28
+ "severity": "warning"
29
+ }],
30
+ "no-descending-specificity": null,
31
+ "no-duplicate-at-import-rules": true,
32
+ "no-duplicate-selectors": true,
33
+ "no-extra-semicolons": true,
34
+ "no-invalid-double-slash-comments": true,
35
+ "no-missing-end-of-source-newline": true,
36
+ "number-leading-zero": "never",
37
+ "number-no-trailing-zeros": true,
38
+ "property-no-unknown": true,
39
+ "rule-empty-line-before": ["always-multi-line", {
40
+ "except": ["first-nested"],
41
+ "ignore": ["after-comment"]
42
+ }],
43
+ "selector-attribute-quotes": "always",
44
+ "selector-attribute-operator-space-after": "never",
45
+ "selector-attribute-operator-space-before": "never",
46
+ "selector-combinator-space-after": "always",
47
+ "selector-combinator-space-before": "always",
48
+ "selector-descendant-combinator-no-non-space": true,
49
+ "selector-list-comma-newline-after": "always",
50
+ "selector-pseudo-class-case": "lower",
51
+ "selector-pseudo-class-no-unknown": true,
52
+ "selector-pseudo-class-parentheses-space-inside": "never",
53
+ "selector-pseudo-element-case": "lower",
54
+ "selector-pseudo-element-colon-notation": "double",
55
+ "selector-pseudo-element-no-unknown": true,
56
+ "selector-type-case": "lower",
57
+ "selector-type-no-unknown": [true, {
58
+ "ignore": ["custom-elements"]
59
+ }],
60
+ "shorthand-property-no-redundant-values": true,
61
+ "string-quotes": "single",
62
+ "unit-case": "lower",
63
+ "value-keyword-case": "lower",
64
+ "value-list-comma-space-after": "always-single-line",
65
+ "value-no-vendor-prefix": true,
66
+ "scss/at-mixin-pattern": null,
67
+ "scss/at-function-pattern": null,
68
+ "scss/dollar-variable-pattern": null,
69
+ "scss/at-else-closing-brace-newline-after": "always-last-in-chain",
70
+ "scss/at-else-closing-brace-space-after": "always-intermediate",
71
+ "scss/at-else-empty-line-before": "never",
72
+ "scss/at-if-closing-brace-newline-after": "always-last-in-chain",
73
+ "scss/at-if-closing-brace-space-after": "always-intermediate",
74
+ "scss/at-import-no-partial-leading-underscore": true,
75
+ "scss/at-mixin-argumentless-call-parentheses": "always",
76
+ "scss/at-mixin-parentheses-space-before": "never",
77
+ "scss/at-rule-no-unknown": true,
78
+ "scss/double-slash-comment-inline": "never",
79
+ "scss/dollar-variable-colon-newline-after": null,
80
+ "scss/dollar-variable-colon-space-after": "always",
81
+ "scss/selector-no-redundant-nesting-selector": true
82
+ }
83
+ }
package/_index.scss CHANGED
@@ -1,2 +1,5 @@
1
- @forward './sass/functions';
2
- @forward './sass/mixins';
1
+ @forward './sass/color';
2
+ @forward './sass/typography';
3
+ @forward './sass/elevations';
4
+ @forward './sass/utils';
5
+ @forward './sass/themes';
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "igniteui-theming",
3
- "version": "1.0.0-alpha",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "A set of Sass variables, mixins, and functions for generating palettes, typography, and elevations used by Ignite UI components.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "jest"
7
+ "build:docs": "npx sassdoc ./sass",
8
+ "build:e2e": "sass ./test/e2e/theme.scss ./test/e2e/theme.css",
9
+ "lint": "stylelint ./sass",
10
+ "test": "jest",
11
+ "serve:docs": "npx http-server ./sassdoc"
8
12
  },
9
13
  "repository": {
10
14
  "type": "git",
@@ -35,9 +39,13 @@
35
39
  },
36
40
  "devDependencies": {
37
41
  "jest": "^28.1.1",
38
- "sass-true": "^6.1.0"
42
+ "postcss": "^8.4.14",
43
+ "sass-true": "^6.1.0",
44
+ "stylelint": "^14.9.1",
45
+ "stylelint-config-standard-scss": "^4.0.0",
46
+ "stylelint-scss": "^4.2.0"
39
47
  },
40
48
  "peerDependencies": {
41
- "sass": "^1.52.3"
49
+ "sass": "^1.53.0"
42
50
  }
43
51
  }
@@ -0,0 +1,5 @@
1
+ @forward 'color';
2
+ @forward 'elevations';
3
+ @forward 'typography';
4
+ @forward 'utils';
5
+ @forward 'themes';
@@ -0,0 +1,31 @@
1
+ /// A list of color values to be used as brushes in charts.
2
+ /// @type List
3
+ /// @access public
4
+ $brushes-regular: (
5
+ rgb(157 231 114),
6
+ rgb(139 91 177),
7
+ rgb(109 177 255),
8
+ rgb(154 242 228),
9
+ rgb(238 88 121),
10
+ rgb(115 86 86),
11
+ rgb(247 210 98),
12
+ rgb(168 168 183),
13
+ rgb(224 81 169),
14
+ rgb(248 161 95),
15
+ );
16
+
17
+ /// A list of color values to be used as color-blind brushes in charts.
18
+ /// @type List
19
+ /// @access public
20
+ $brushes-color-blind: (
21
+ rgb(86 180 233),
22
+ rgb(0 158 115),
23
+ rgb(240 228 68),
24
+ rgb(213 94 0),
25
+ rgb(214 0 254),
26
+ rgb(0 73 159),
27
+ rgb(230 159 0),
28
+ rgb(0 0 0),
29
+ rgb(132 240 223),
30
+ rgb(115 86 86)
31
+ );
@@ -0,0 +1,350 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use 'sass:math';
4
+ @use 'sass:list';
5
+ @use 'sass:color';
6
+ @use 'sass:string';
7
+ @use 'charts';
8
+ @use 'multipliers';
9
+ @use 'types';
10
+ @use '../utils/math' as *;
11
+
12
+ $_enhanced-accessibility: false;
13
+
14
+ /// Configures the color module.
15
+ /// @access public
16
+ /// @param {Boolean} $enhanced-accessibility [null] - Enables features like color blind palettes.
17
+ @mixin configure($enhanced-accessibility: null) {
18
+ @if $enhanced-accessibility {
19
+ $_enhanced-accessibility: $enhanced-accessibility !global;
20
+ }
21
+ }
22
+
23
+ /// Generates a color palette.
24
+ /// @access public
25
+ /// @group Palettes
26
+ /// @param {Color} $primary - The primary color used to generate the primary color palette (required).
27
+ /// @param {Color} $secondary - The secondary color used to generate the secondary color palette (required).
28
+ /// @param {Color} $surface - The color used as a background in components, such as cards, sheets, and menus (required).
29
+ /// @param {Color} $gray [null] - The color used for generating the grayscale palette (optional).
30
+ /// @param {Color} $info [null] - The information color used throughout the application (optional).
31
+ /// @param {Color} $success [null] - The success color used throughout the application (optional).
32
+ /// @param {Color} $warn [null] - The warning color used throughout the application (optional).
33
+ /// @param {Color} $error [null] - The error color used throughout the application (optional).
34
+ /// @param {String} $variant [null] - Used internally (optional).
35
+ /// @requires {function} shades
36
+ /// @returns {Map} - A map consisting of color shades for the passed base colors (primary, secondary, gray, etc).
37
+ @function palette(
38
+ $primary,
39
+ $secondary,
40
+ $surface,
41
+ $gray: null,
42
+ $info: null,
43
+ $success: null,
44
+ $warn: null,
45
+ $error: null,
46
+ $variant: null,
47
+ ) {
48
+ $color-shades: map.keys(types.$IColorShades);
49
+ $gray-shades: map.keys(types.$IGrayShades);
50
+ $primary-palette: shades('primary', $primary, $color-shades);
51
+ $secondary-palette: shades('secondary', $secondary, $color-shades);
52
+ $surface-palette: shades('surface', $surface, $color-shades);
53
+ $grayscale-palette: shades('gray', $gray, $gray-shades, $surface);
54
+ $info-palette: if($info, shades('info', $info, $color-shades), ());
55
+ $success-palette: if($success, shades('success', $success, $color-shades), ());
56
+ $warn-palette: if($warn, shades('warn', $warn, $color-shades), ());
57
+ $error-palette: if($success, shades('error', $error, $color-shades), ());
58
+
59
+ @return (
60
+ 'primary': $primary-palette,
61
+ 'secondary': $secondary-palette,
62
+ 'gray': $grayscale-palette,
63
+ 'surface': $surface-palette,
64
+ 'info': $info-palette,
65
+ 'success': $success-palette,
66
+ 'warn': $warn-palette,
67
+ 'error': $error-palette,
68
+ '_meta': (
69
+ 'variant': $variant,
70
+ )
71
+ );
72
+ }
73
+
74
+ /// Generates a Material-like color palette from a base color.
75
+ /// @access public
76
+ /// @group Palettes
77
+ /// @param {String} $name - The name of the color.
78
+ /// @param {Color} $color - The base color used to generate the palette.
79
+ /// @param {List} $shades - The list of shades.
80
+ /// @param {Color} $surface [null] - The surface color. Usefull when generating shades of gray (optional).
81
+ /// @requires {function} shade
82
+ /// @requires {function} text-contrast
83
+ /// @returns {Map} - A map consisting of hsla color shades and thier respective contrast colors.
84
+ @function shades(
85
+ $name,
86
+ $color,
87
+ $shades,
88
+ $surface: null
89
+ ) {
90
+ $result: ();
91
+
92
+ @each $variant in $shades {
93
+ $shade: shade($name, $color, $variant, $surface);
94
+ $result: map.merge(
95
+ $result,
96
+ (
97
+ $variant: map.get($shade, 'raw'),
98
+ #{$variant}-contrast: text-contrast(map.get($shade, 'raw')),
99
+ #{$variant}-hsl: map.get($shade, 'hsl'),
100
+ )
101
+ );
102
+ }
103
+
104
+ @return $result;
105
+ }
106
+
107
+ /// Generates a color shade for a given base colors.
108
+ /// @access private
109
+ /// @group Palettes
110
+ /// @param {String} $name - The base color name (primary, secondary, etc.) to be used to generate a color variant.
111
+ /// @param {Color} $color - The color value to be used to generate a color shade.
112
+ /// @param {String | Number} $shade - The color shade variant.
113
+ /// @param {Color} $surface [null] - The surface color. Usefull when generating a shade of gray (optional).
114
+ /// @require {function} luminance
115
+ /// @require {function} to-fixed
116
+ /// @returns {Map} - A map containing a list of HSL values and a raw color value.
117
+ @function shade(
118
+ $name,
119
+ $color,
120
+ $shade,
121
+ $surface: null,
122
+ ) {
123
+ $h: var(--ig-#{$name}-h);
124
+ $s: var(--ig-#{$name}-s);
125
+ $l: var(--ig-#{$name}-l);
126
+
127
+ @if #{$name} == 'gray' {
128
+ $lum: luminance($surface);
129
+ $color: if($color, $color, if($lum > .5, #000, #fff));
130
+ $lmap: map.get(multipliers.$grayscale, 'l');
131
+ $len: list.length($lmap);
132
+ $i: list.index(map.keys($lmap), $shade);
133
+ $l: list.nth(map.values($lmap), if($lum > .5, $len - $i + 1, $i));
134
+
135
+ @return (
136
+ raw: hsl(
137
+ to-fixed(color.hue($color)),
138
+ to-fixed(color.saturation($color)),
139
+ $l
140
+ ),
141
+ hsl: #{$h, $s, $l}
142
+ );
143
+ } @else {
144
+ $sx: map.get(multipliers.$color, 's', $shade);
145
+ $lx: map.get(multipliers.$color, 'l', $shade);
146
+
147
+ @return (
148
+ raw: hsl(
149
+ to-fixed(color.hue($color)),
150
+ to-fixed(color.saturation($color) * $sx),
151
+ to-fixed(color.lightness($color) * $lx)
152
+ ),
153
+ hsl: #{$h, calc(#{$s} * #{$sx}), calc(#{$l} * #{$lx})}
154
+ );
155
+ }
156
+ }
157
+
158
+ /// Retrieves a color from a color palette.
159
+ /// @access public
160
+ /// @group Palettes
161
+ /// @param {Map} $palette [null] - The source palette map (optional).
162
+ /// @param {String} $color [primary] - The target color from the color palette.
163
+ /// @param {Number | String} $variant [500] - The target color shade from the color palette.
164
+ /// @param {Number} $opacity [null] - Optional opacity to apply to the color shade.
165
+ /// @returns {Color | String} - The raw color shade or CSS variable reference from the palette.
166
+ @function color($palette: null, $color: 'primary', $variant: 500, $opacity: null) {
167
+ $c: map.get($palette or types.$IPalette, #{$color});
168
+ $a: var(--ig-#{$color}-a);
169
+ $s: #{var(--ig-#{$color}-#{$variant})};
170
+ $contrast: if(
171
+ meta.type-of($variant) == string,
172
+ string.index($variant, 'contrast'),
173
+ false
174
+ );
175
+ $meta: if($palette, map.get($palette, '_meta'), null);
176
+
177
+ @if not($c) {
178
+ @error 'The passed color #{meta.inspect($color)} is not valid.';
179
+ }
180
+
181
+ @if not($palette) or not($meta) {
182
+ @return if(
183
+ $contrast,
184
+ $s,
185
+ hsla($s, if($opacity, $opacity, $a)),
186
+ );
187
+ }
188
+
189
+ @return rgba(map.get($c, $variant), $alpha: if($opacity, $opacity, 1));
190
+ }
191
+
192
+ /// Retrieves a contrast text color for a given color from a color palette.
193
+ /// @access public
194
+ /// @group Palettes
195
+ /// @param {Map} $palette [null] - The source palette map (optional).
196
+ /// @param {String} $color [primary] - The target color from the color palette.
197
+ /// @param {Number | String} $variant [500] - The target color shade from the color palette.
198
+ /// @requires {function} color
199
+ /// @returns {Color | String} - The raw contrast color shade or CSS variable from the palette.
200
+ @function contrast-color($palette: null, $color: primary, $variant: 500) {
201
+ @return color($palette, $color, #{$variant}-contrast);
202
+ }
203
+
204
+ /// Returns a contrast color for a passed color.
205
+ /// @access public
206
+ /// @group Color
207
+ /// @param {Color} $background - The background color used to return a contrast/forground color for.
208
+ /// @param {Color | List<Color>} $foreground [#fff] - A list of foreground colors
209
+ /// that can be used with the provided background.
210
+ /// @param {AAA | AA | A} $contrast [AAA] - The contrast level according to WCAG 2.0 standards.
211
+ /// @require {function} contrast
212
+ /// @returns {Color} - Returns either white, black, or the provided foreground
213
+ /// color if it meets the required contrast level.
214
+ /// @link https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
215
+ @function text-contrast(
216
+ $background,
217
+ $foreground: white,
218
+ $contrast: 'AAA'
219
+ ) {
220
+ @if meta.type-of($foreground) != 'list' and meta.type-of($background) != 'color' {
221
+ @return $background;
222
+ }
223
+
224
+ $level: map.get(
225
+ (
226
+ 'a': 3,
227
+ 'aa': 4.5,
228
+ 'aaa': 7
229
+ ),
230
+ string.to-lower-case($contrast)
231
+ );
232
+
233
+ @if not($level) {
234
+ @error "$contrast must be 'A', 'AA', or 'AAA'";
235
+ }
236
+
237
+ $candidates: ();
238
+
239
+ @each $color in $foreground {
240
+ @if meta.type-of($color) != 'color' {
241
+ @return $background;
242
+ }
243
+
244
+ $candidates: list.append($candidates, contrast($background, $color));
245
+ }
246
+
247
+ $foreground: list.nth($foreground, list.index($candidates, math.max($candidates...)));
248
+
249
+ @if contrast($background, $foreground) >= $level {
250
+ @return $foreground;
251
+ } @else {
252
+ $lightContrast: contrast($background, white);
253
+ $darkContrast: contrast($background, black);
254
+
255
+ @if $lightContrast > $darkContrast {
256
+ @return white;
257
+ } @else {
258
+ @return black;
259
+ }
260
+ }
261
+ }
262
+
263
+ /// Mixes two colors to produce an opaque color.
264
+ /// @access public
265
+ /// @group Color
266
+ /// @param {Color} $color-1 - The first color, usually transparent.
267
+ /// @param {Color} $color-2 [#fff] - The second color, usually opaque.
268
+ /// @return {Color} - The color representation of the rgba value.
269
+ @function to-opaque($color-1, $color-2: #fff) {
270
+ @if meta.type-of($color-1) == color and meta.type-of($color-2) == color {
271
+ $red: color.red($color-1);
272
+ $green: color.green($color-1);
273
+ $blue: color.blue($color-1);
274
+ $a: color.alpha($color-1);
275
+ $r: math.floor($a * $red + (1 - $a) * color.red($color-2));
276
+ $g: math.floor($a * $green + (1 - $a) * color.green($color-2));
277
+ $b: math.floor($a * $blue + (1 - $a) * color.blue($color-2));
278
+
279
+ @return rgb($r, $g, $b);
280
+ }
281
+
282
+ @return $color-1;
283
+ }
284
+
285
+ /// Retruns a comma separated list of hue, saturation, and lightness values for a given color.
286
+ /// @access public
287
+ /// @group Color
288
+ /// @param {Color} $color - The color to be converted to an HSL list of values.
289
+ /// @example scss Turn #000 into an HSL list of values
290
+ /// $hsl-list: to-hsl(#000); // (0deg, 0%, 0%);
291
+ /// @return {List} - This list of HSL values.
292
+ @function to-hsl($color) {
293
+ @return (color.hue($color), color.saturation($color), color.lightness($color));
294
+ }
295
+
296
+ /// Calculates the contrast ratio between two colors.
297
+ /// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
298
+ /// @access public
299
+ /// @group Color
300
+ /// @param {Color} $background - The background color.
301
+ /// @param {Color} $foreground - The foreground color.
302
+ /// @require {function} luminance
303
+ /// @require {function} to-fixed
304
+ /// @returns {Number} - The contrast ratio between the background and foreground colors.
305
+ @function contrast($background, $foreground) {
306
+ $backLum: luminance($background) + .05;
307
+ $foreLum: luminance($foreground) + .05;
308
+
309
+ @return to-fixed(math.div(math.max($backLum, $foreLum), math.min($backLum, $foreLum)));
310
+ }
311
+
312
+ /// Calculates the luminance for a given color.
313
+ /// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests.
314
+ /// @access public
315
+ /// @group Color
316
+ /// @param {Color} $color - The color to calculate luminance for.
317
+ /// @returns {Number | String} - The calculated luminance of a given color
318
+ @function luminance($color) {
319
+ @if meta.type-of($color) == 'color' {
320
+ $r: math.div(color.red($color), 255);
321
+ $g: math.div(color.green($color), 255);
322
+ $b: math.div(color.blue($color), 255);
323
+
324
+ @return .2126 * _lcv($r) + .7152 * _lcv($g) + .0722 * _lcv($b);
325
+ }
326
+
327
+ @return $color;
328
+ }
329
+
330
+ /// Calculates the linear channel value for a given sRGB color.
331
+ /// @access private
332
+ /// @group Color
333
+ /// @param {Number} $value - The sRGB color
334
+ /// @returns {Number} - The calculated linear channel value
335
+ @function _lcv($value) {
336
+ /* stylelint-disable number-max-precision */
337
+ @return if(
338
+ $value < .03928,
339
+ math.div($value, 12.92),
340
+ math.pow(math.div($value + .055, 1.055), 2.4)
341
+ );
342
+ }
343
+
344
+ /// Returns a list of colors to be used as chart brushes.
345
+ /// @access public
346
+ /// @group Palettes
347
+ /// @returns { List } - A list of colors to be used as chart brushes.
348
+ @function chart-brushes() {
349
+ @return if($_enhanced-accessibility, charts.$brushes-color-blind, charts.$brushes-regular);
350
+ }
@@ -0,0 +1,5 @@
1
+ @forward 'functions';
2
+ @forward 'mixins';
3
+ @forward 'types';
4
+ @forward 'multipliers';
5
+ @forward 'charts';
@@ -0,0 +1,48 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use 'sass:math';
4
+ @use 'sass:color';
5
+ @use 'sass:string';
6
+ @use '../utils/meta' as *;
7
+
8
+ /// Generates CSS variables for a given palette.
9
+ /// @access public
10
+ /// @group Palettes
11
+ /// @param {Map} $palette - The palette used to generate CSS variables.
12
+ /// @param {Boolean} $contrast [true] - Specify if contrast colors should be included.
13
+ /// @example scss Generate css variables for a palette
14
+ /// $palette: palette($primary: red, $secondary: blue, $gray: #000);
15
+ /// @include palette($palette);
16
+ /// @require {function} is-root
17
+ @mixin palette($palette, $contrast: true) {
18
+ $scope: if(is-root(), ':root', '&');
19
+
20
+ #{$scope} {
21
+ @each $color, $shades in map.remove($palette, '_meta') {
22
+ @each $shade, $value in $shades {
23
+ $_base-shade: $shade == 500;
24
+ $_valid-color: meta.type-of($value == 'color');
25
+ $_other-shade: meta.type-of($shade) == 'string';
26
+ $_hsl: if($_other-shade, string.index($shade, 'hsl'), false);
27
+ $_contrast: if($_other-shade, string.index($shade, 'contrast'), false);
28
+
29
+ @if $_base-shade and $_valid-color {
30
+ --ig-#{$color}-h: #{math.round(color.hue($value))};
31
+ --ig-#{$color}-s: #{math.round(color.saturation($value))};
32
+ --ig-#{$color}-l: #{math.round(color.lightness($value))};
33
+ --ig-#{$color}-a: #{color.alpha($value)};
34
+ }
35
+
36
+ @if $_hsl {
37
+ $variant: string.slice($shade, 1, string.index($shade, '-hsl') - 1);
38
+
39
+ --ig-#{$color}-#{$variant}: #{$value};
40
+ }
41
+
42
+ @if $_contrast and $contrast {
43
+ --ig-#{$color}-#{$shade}: #{$value};
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,48 @@
1
+ $color: (
2
+ s: (
3
+ 50: 1.23,
4
+ 100: .8,
5
+ 200: .64,
6
+ 300: .73,
7
+ 400: .875,
8
+ 500: 1,
9
+ 600: 1.26,
10
+ 700: 1.52,
11
+ 800: 1.5,
12
+ 900: 1.34,
13
+ 'A100': 1.23,
14
+ 'A200': 1.22,
15
+ 'A400': 1.23,
16
+ 'A700': 1.23
17
+ ),
18
+ l: (
19
+ 50: 1.78,
20
+ 100: 1.66,
21
+ 200: 1.43,
22
+ 300: 1.19,
23
+ 400: 1.08,
24
+ 500: 1,
25
+ 600: .89,
26
+ 700: .81,
27
+ 800: .73,
28
+ 900: .64,
29
+ 'A100': 1.34,
30
+ 'A200': 1.16,
31
+ 'A400': .91,
32
+ 'A700': .65
33
+ )
34
+ );
35
+ $grayscale: (
36
+ l: (
37
+ 50: 13%,
38
+ 100: 26%,
39
+ 200: 38%,
40
+ 300: 54%,
41
+ 400: 62%,
42
+ 500: 74%,
43
+ 600: 88%,
44
+ 700: 93%,
45
+ 800: 96%,
46
+ 900: 98%
47
+ )
48
+ );
@@ -0,0 +1,55 @@
1
+ @use 'sass:map';
2
+
3
+ ////
4
+ /// @group Palettes
5
+ ////
6
+
7
+ /// A list consisting of all generated gray shades
8
+ /// @type Map
9
+ $IGrayShades: (
10
+ 50: '',
11
+ 100: '',
12
+ 200: '',
13
+ 300: '',
14
+ 400: '',
15
+ 500: '',
16
+ 600: '',
17
+ 700: '',
18
+ 800: '',
19
+ 900: '',
20
+ );
21
+
22
+ /// A list consisting of all generated shades for palette colors
23
+ /// @type Map
24
+ $IColorShades: map.merge(
25
+ $IGrayShades,
26
+ (
27
+ 'A100': '',
28
+ 'A200': '',
29
+ 'A400': '',
30
+ 'A700': '',
31
+ )
32
+ );
33
+
34
+ /// All palette colors mapped with corresponding color shades
35
+ /// @type Map
36
+ $IPaletteColors: (
37
+ 'primary': $IColorShades,
38
+ 'secondary': $IColorShades,
39
+ 'gray': $IGrayShades,
40
+ 'surface': $IColorShades,
41
+ 'info': $IColorShades,
42
+ 'success': $IColorShades,
43
+ 'warn': $IColorShades,
44
+ 'error': $IColorShades,
45
+ );
46
+
47
+ /// A list consisting of palette metadata
48
+ /// @type Map
49
+ $IPaletteMeta: (
50
+ 'variant': '',
51
+ );
52
+
53
+ /// A map with all palette colors and palette meta
54
+ /// @type Map
55
+ $IPalette: map.merge($IPaletteColors, (_meta: $IPaletteMeta));
@@ -0,0 +1,2 @@
1
+ @forward 'light';
2
+ @forward 'dark';