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

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 (54) 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 +348 -0
  8. package/sass/color/_index.scss +6 -0
  9. package/sass/color/_mixins.scss +48 -0
  10. package/sass/color/_multipliers.scss +48 -0
  11. package/sass/color/_types.scss +37 -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/_fluent.scss +11 -0
  15. package/sass/color/presets/dark/_index.scss +4 -0
  16. package/sass/color/presets/dark/_indigo.scss +13 -0
  17. package/sass/color/presets/dark/_material.scss +8 -0
  18. package/sass/color/presets/light/_bootstrap.scss +13 -0
  19. package/sass/color/presets/light/_fluent.scss +12 -0
  20. package/sass/color/presets/light/_index.scss +4 -0
  21. package/sass/color/presets/light/_indigo.scss +13 -0
  22. package/sass/color/presets/light/_material.scss +8 -0
  23. package/sass/elevations/_functions.scss +87 -0
  24. package/sass/elevations/_index.scss +3 -0
  25. package/sass/elevations/_mixins.scss +34 -0
  26. package/sass/elevations/presets/_index.scss +1 -0
  27. package/sass/elevations/presets/_material.scss +62 -0
  28. package/sass/themes/_functions.scss +110 -0
  29. package/sass/themes/_index.scss +2 -0
  30. package/sass/themes/_mixins.scss +111 -0
  31. package/sass/typography/_functions.scss +146 -0
  32. package/sass/typography/_index.scss +4 -0
  33. package/sass/typography/_mixins.scss +100 -0
  34. package/sass/typography/_types.scss +35 -0
  35. package/sass/typography/presets/_bootstrap.scss +127 -0
  36. package/sass/typography/presets/_fluent.scss +103 -0
  37. package/sass/typography/presets/_index.scss +4 -0
  38. package/sass/typography/presets/_indigo.scss +115 -0
  39. package/sass/typography/presets/_material.scss +127 -0
  40. package/sass/utils/_index.scss +3 -0
  41. package/sass/utils/_map.scss +37 -0
  42. package/sass/utils/_math.scss +7 -0
  43. package/sass/utils/_meta.scss +16 -0
  44. package/test/_color.spec.scss +251 -0
  45. package/test/_elevations.spec.scss +69 -0
  46. package/test/_index.scss +5 -0
  47. package/test/_themes.spec.scss +253 -0
  48. package/test/_typography.spec.scss +251 -0
  49. package/test/_utils.spec.scss +53 -0
  50. package/test/e2e/theme.scss +4 -0
  51. package/{tests → test}/test.js +0 -0
  52. package/sass/_functions.scss +0 -3
  53. package/sass/_mixins.scss +0 -4
  54. 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.3",
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,348 @@
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' as *;
11
+
12
+ $_enhanced-accessibility: false;
13
+
14
+ /// Configures the color module.
15
+ /// @access public
16
+ /// @param {Boolean} $enhanced-accessibility - 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
+ /// @requires {function} _color-palette
27
+ /// @param {Color} $primary - The primary color used to generate the primary color palette (required).
28
+ /// @param {Color} $secondary - The secondary color used to generate the secondary color palette (required).
29
+ /// @param {Color} $surface - The color used as a background in components, such as cards, sheets, and menus (required).
30
+ /// @param {Color} $gray [null] - The color used for generating the grayscale palette (optional).
31
+ /// @param {Color} $info [null] - The information color used throughout the application (optional).
32
+ /// @param {Color} $success [null] - The success color used throughout the application (optional).
33
+ /// @param {Color} $warn [null] - The warning color used throughout the application (optional).
34
+ /// @param {Color} $error [null] - The error color used throughout the application (optional).
35
+ /// @param {String} $variant [null] - Used internally (optional).
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} _color-shade
82
+ /// @requires {function} _hsla-shade
83
+ /// @requires {function} contrast
84
+ /// @requires {function} to-opaque
85
+ /// @returns {Map} - A map consisting of hsla color shades and thier respective contrast colors.
86
+ @function shades(
87
+ $name,
88
+ $color,
89
+ $shades,
90
+ $surface: null
91
+ ) {
92
+ $result: ();
93
+
94
+ @each $variant in $shades {
95
+ $shade: shade($name, $color, $variant, $surface);
96
+ $result: map.merge(
97
+ $result,
98
+ (
99
+ $variant: map.get($shade, 'raw'),
100
+ #{$variant}-contrast: text-contrast(map.get($shade, 'raw')),
101
+ #{$variant}-hsl: map.get($shade, 'hsl'),
102
+ )
103
+ );
104
+ }
105
+
106
+ @return $result;
107
+ }
108
+
109
+ /// Generates a color shade for a given base colors.
110
+ /// @access private
111
+ /// @group Palettes
112
+ /// @param {String} $name - The base color name (primary, secondary, etc.) to be used to generate a color variant.
113
+ /// @param {Color} $color - The color value to be used to generate a color shade.
114
+ /// @param {String | Number} $shade - The color shade variant.
115
+ /// @param {Color} $surface [null] - The surface color. Usefull when generating a shade of gray (optional).
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 #{$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 Palettesreference
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 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
+ /// @returns {Color} - Returns either white, black, or the provided foreground
212
+ /// color if it meets the required contrast level.
213
+ /// @link https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
214
+ @function text-contrast(
215
+ $background,
216
+ $foreground: white,
217
+ $contrast: 'AAA'
218
+ ) {
219
+ @if meta.type-of($foreground) != 'list' and meta.type-of($background) != 'color' {
220
+ @return $background;
221
+ }
222
+
223
+ $level: map.get(
224
+ (
225
+ 'a': 3,
226
+ 'aa': 4.5,
227
+ 'aaa': 7
228
+ ),
229
+ string.to-lower-case($contrast)
230
+ );
231
+
232
+ @if not($level) {
233
+ @error "$contrast must be 'A', 'AA', or 'AAA'";
234
+ }
235
+
236
+ $candidates: ();
237
+
238
+ @each $color in $foreground {
239
+ @if meta.type-of($color) != 'color' {
240
+ @return $background;
241
+ }
242
+
243
+ $candidates: list.append($candidates, contrast($background, $color));
244
+ }
245
+
246
+ $foreground: list.nth($foreground, list.index($candidates, math.max($candidates...)));
247
+
248
+ @if contrast($background, $foreground) >= $level {
249
+ @return $foreground;
250
+ } @else {
251
+ $lightContrast: contrast($background, white);
252
+ $darkContrast: contrast($background, black);
253
+
254
+ @if $lightContrast > $darkContrast {
255
+ @return white;
256
+ } @else {
257
+ @return black;
258
+ }
259
+ }
260
+ }
261
+
262
+ /// Mixes two colors to produce an opaque color.
263
+ /// @access public
264
+ /// @param {Color} $color-1 - The first color, usually transparent.
265
+ /// @param {Color} $color-2 [#fff] - The second color, usually opaque.
266
+ /// @return {Color} - The color representation of the rgba value.
267
+ @function to-opaque($color-1, $color-2: #fff) {
268
+ @if meta.type-of($color-1) == color and meta.type-of($color-2) == color {
269
+ $red: color.red($color-1);
270
+ $green: color.green($color-1);
271
+ $blue: color.blue($color-1);
272
+ $a: color.alpha($color-1);
273
+ $r: math.floor($a * $red + (1 - $a) * color.red($color-2));
274
+ $g: math.floor($a * $green + (1 - $a) * color.green($color-2));
275
+ $b: math.floor($a * $blue + (1 - $a) * color.blue($color-2));
276
+
277
+ @return rgb($r, $g, $b);
278
+ }
279
+
280
+ @return $color-1;
281
+ }
282
+
283
+ /// Retruns a comma separated list of hue, saturation, and lightness values for a given color.
284
+ /// @access public
285
+ /// @param {Color} $color - The color to be converted to an HSL list of values.
286
+ /// @example scss Turn #000 into an HSL list of values
287
+ /// $hsl-list: to-hsl(#000); // (0deg, 0%, 0%);
288
+ /// @return {List} - This list of HSL values.
289
+ @function to-hsl($color) {
290
+ @return (color.hue($color), color.saturation($color), color.lightness($color));
291
+ }
292
+
293
+ /// Calculates the contrast ratio between two colors.
294
+ /// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
295
+ ///
296
+ /// @param {Color} $background - The background color.
297
+ /// @param {Color} $foreground - The foreground color.
298
+ /// @returns {Number} - The contrast ratio between the background and foreground colors.
299
+ @function contrast($background, $foreground) {
300
+ $backLum: luminance($background) + .05;
301
+ $foreLum: luminance($foreground) + .05;
302
+
303
+ @return to-fixed(math.div(math.max($backLum, $foreLum), math.min($backLum, $foreLum)));
304
+ }
305
+
306
+ /// Calculates the luminance for a given color.
307
+ /// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests.
308
+ ///
309
+ /// @param {Color} $color - The color to calculate luminance for.
310
+ @function luminance($color) {
311
+ @if meta.type-of($color) == 'color' {
312
+ $r: math.div(color.red($color), 255);
313
+ $g: math.div(color.green($color), 255);
314
+ $b: math.div(color.blue($color), 255);
315
+
316
+ @return .2126 * _lcv($r) + .7152 * _lcv($g) + .0722 * _lcv($b);
317
+ }
318
+
319
+ @return $color;
320
+ }
321
+
322
+ /// Calculates the linear channel value for a given sRGB color.
323
+ /// @access private
324
+ @function _lcv($value) {
325
+ /* stylelint-disable number-max-precision */
326
+ @return if(
327
+ $value < .03928,
328
+ math.div($value, 12.92),
329
+ math.pow(math.div($value + .055, 1.055), 2.4)
330
+ );
331
+ }
332
+
333
+ /// Returns a list of colors to be used as chart brushes.
334
+ /// @access public
335
+ /// @group Palettes
336
+ /// @returns { List } - A list of colors to be used as chart brushes.
337
+ @function chart-brushes() {
338
+ @return if($_enhanced-accessibility, charts.$brushes-color-blind, charts.$brushes-regular);
339
+ }
340
+
341
+ /// Returns a list of H, S, L values for a given color.
342
+ /// @access public
343
+ /// @param {Color} $color - The color to generate HSL values for.
344
+ /// @group Palettes
345
+ /// @returns { List } - The list of values.
346
+ @function to-hsl($color) {
347
+ @return (color.hue($color), color.saturation($color), color.lightness($color));
348
+ }
@@ -0,0 +1,6 @@
1
+ @forward 'functions';
2
+ @forward 'mixins';
3
+ @forward 'types';
4
+ @forward 'multipliers';
5
+ @forward 'charts';
6
+ @forward 'presets';
@@ -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 [null] - 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
+ ///
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-#{meta.inspect($color)}-h: #{math.round(color.hue($value))};
31
+ --ig-#{meta.inspect($color)}-s: #{math.round(color.saturation($value))};
32
+ --ig-#{meta.inspect($color)}-l: #{math.round(color.lightness($value))};
33
+ --ig-#{meta.inspect($color)}-a: #{color.alpha($value)};
34
+ }
35
+
36
+ @if $_hsl {
37
+ $variant: string.slice($shade, 1, string.index($shade, '-hsl') - 1);
38
+
39
+ --ig-#{meta.inspect($color)}-#{$variant}: #{$value};
40
+ }
41
+
42
+ @if $_contrast and $contrast {
43
+ --ig-#{meta.inspect($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,37 @@
1
+ @use 'sass:map';
2
+
3
+ $IGrayShades: (
4
+ 50: '',
5
+ 100: '',
6
+ 200: '',
7
+ 300: '',
8
+ 400: '',
9
+ 500: '',
10
+ 600: '',
11
+ 700: '',
12
+ 800: '',
13
+ 900: '',
14
+ );
15
+ $IColorShades: map.merge(
16
+ $IGrayShades,
17
+ (
18
+ 'A100': '',
19
+ 'A200': '',
20
+ 'A400': '',
21
+ 'A700': '',
22
+ )
23
+ );
24
+ $IPaletteColors: (
25
+ primary: $IColorShades,
26
+ secondary: $IColorShades,
27
+ gray: $IGrayShades,
28
+ surface: $IColorShades,
29
+ info: $IColorShades,
30
+ success: $IColorShades,
31
+ warn: $IColorShades,
32
+ error: $IColorShades,
33
+ );
34
+ $IPaletteMeta: (
35
+ variant: '',
36
+ );
37
+ $IPalette: map.merge($IPaletteColors, (_meta: $IPaletteMeta));
@@ -0,0 +1,2 @@
1
+ @forward 'light';
2
+ @forward 'dark';
@@ -0,0 +1,13 @@
1
+ @use '../../functions' as *;
2
+
3
+ $palette: palette(
4
+ $primary: #0d6efd,
5
+ $secondary: #6c757d,
6
+ $gray: #adb5bd,
7
+ $surface: #212529,
8
+ $info: #0dcaf0,
9
+ $success: #198754,
10
+ $warn: #ffc107,
11
+ $error: #dc3545,
12
+ $variant: 'bootstrap'
13
+ );