@grantcodes/style-dictionary 1.2.1 → 1.3.1

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 (70) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/css/grantcodes/grantcodes.css +367 -0
  3. package/dist/css/grantcodes/tokens.css +367 -0
  4. package/dist/css/todomap/todomap.css +200 -0
  5. package/dist/css/todomap/tokens.css +200 -0
  6. package/dist/css/wireframe/tokens.css +426 -0
  7. package/dist/css/wireframe/wireframe.css +426 -0
  8. package/dist/js/grantcodes/style-dictionary.d.ts +361 -0
  9. package/dist/js/grantcodes/style-dictionary.js +386 -0
  10. package/dist/js/todomap/style-dictionary.d.ts +202 -0
  11. package/dist/js/todomap/style-dictionary.js +220 -0
  12. package/dist/js/wireframe/style-dictionary.d.ts +414 -0
  13. package/dist/js/wireframe/style-dictionary.js +427 -0
  14. package/dist/json/grantcodes/tokens.json +351 -0
  15. package/dist/json/todomap/tokens.json +200 -0
  16. package/dist/json/wireframe/tokens.json +404 -0
  17. package/package.json +66 -61
  18. package/.turbo/turbo-build.log +0 -45
  19. package/biome.json +0 -9
  20. package/build.js +0 -10
  21. package/config.js +0 -485
  22. package/demo.html +0 -171
  23. package/lib/color-generator.js +0 -13
  24. package/lib/get-style-dictionary-config.js +0 -223
  25. package/lib/get-themes.js +0 -10
  26. package/lib/index.js +0 -3
  27. package/tests/tokens.test.js +0 -87
  28. package/tokens/core/tier-1-definitions/colors.json +0 -175
  29. package/tokens/core/tier-1-definitions/z-index.json +0 -29
  30. package/tokens/grantcodes/tier-1-definitions/animation.json +0 -27
  31. package/tokens/grantcodes/tier-1-definitions/borders.json +0 -36
  32. package/tokens/grantcodes/tier-1-definitions/colors.json +0 -35
  33. package/tokens/grantcodes/tier-1-definitions/shadows.json +0 -39
  34. package/tokens/grantcodes/tier-1-definitions/typography.json +0 -133
  35. package/tokens/grantcodes/tier-2-usage/00-colors-background.json +0 -72
  36. package/tokens/grantcodes/tier-2-usage/00-colors-border.json +0 -42
  37. package/tokens/grantcodes/tier-2-usage/00-colors-content.json +0 -45
  38. package/tokens/grantcodes/tier-2-usage/animation.json +0 -23
  39. package/tokens/grantcodes/tier-2-usage/borders.json +0 -26
  40. package/tokens/grantcodes/tier-2-usage/shadows.json +0 -39
  41. package/tokens/grantcodes/tier-2-usage/typography-usage.json +0 -277
  42. package/tokens/grantcodes/tier-3-components/button.json +0 -94
  43. package/tokens/grantcodes/tier-3-components/focus-ring.json +0 -26
  44. package/tokens/grantcodes/tier-3-components/form.json +0 -69
  45. package/tokens/grantcodes/tier-3-components/link.json +0 -39
  46. package/tokens/todomap/tier-1-definitions/colors.json +0 -92
  47. package/tokens/todomap/tier-1-definitions/typography.json +0 -10
  48. package/tokens/todomap/tier-2-usage/00-colors-background.json +0 -36
  49. package/tokens/todomap/tier-2-usage/00-colors-content.json +0 -33
  50. package/tokens/todomap/tier-2-usage/typography-usage.json +0 -20
  51. package/tokens/todomap/tier-3-components/button.json +0 -141
  52. package/tokens/todomap/tier-3-components/focus-ring.json +0 -26
  53. package/tokens/todomap/tier-3-components/form.json +0 -69
  54. package/tokens/todomap/tier-3-components/link.json +0 -39
  55. package/tokens/wireframe/tier-1-definitions/animation.json +0 -18
  56. package/tokens/wireframe/tier-1-definitions/borders.json +0 -42
  57. package/tokens/wireframe/tier-1-definitions/colors.json +0 -36
  58. package/tokens/wireframe/tier-1-definitions/shadows.json +0 -39
  59. package/tokens/wireframe/tier-1-definitions/typography.json +0 -130
  60. package/tokens/wireframe/tier-2-usage/00-colors-background.json +0 -86
  61. package/tokens/wireframe/tier-2-usage/00-colors-border.json +0 -42
  62. package/tokens/wireframe/tier-2-usage/00-colors-content.json +0 -45
  63. package/tokens/wireframe/tier-2-usage/animation.json +0 -24
  64. package/tokens/wireframe/tier-2-usage/borders.json +0 -33
  65. package/tokens/wireframe/tier-2-usage/shadows.json +0 -39
  66. package/tokens/wireframe/tier-2-usage/typography-usage.json +0 -445
  67. package/tokens/wireframe/tier-3-components/button.json +0 -94
  68. package/tokens/wireframe/tier-3-components/focus-ring.json +0 -26
  69. package/tokens/wireframe/tier-3-components/form.json +0 -69
  70. package/tokens/wireframe/tier-3-components/link.json +0 -39
package/config.js DELETED
@@ -1,485 +0,0 @@
1
- import StyleDictionary from "style-dictionary";
2
- import minimist from "minimist";
3
-
4
- /**
5
- * List of themes to build
6
- * 1) Add your new theme here in order to have it show up in the dropdown
7
- */
8
- const AVAILABLE_THEMES = ["wireframe", "grantcodes", "todomap"];
9
-
10
- /**
11
- * Look for args passed on the command line
12
- * 1) Used to build a single theme if needed
13
- * 2) Pass in the theme name as an argument
14
- * 3) If no argument is passed, build all themes
15
- */
16
- const args = minimist(process.argv.slice(2));
17
- const theme = args.theme;
18
-
19
- /**
20
- * Helper function to check if token is from tier-2 or tier-3
21
- * 1) Used to determine if the token should be included in the theme tokens to apply `theme` prefix
22
- */
23
- const isHigherTierToken = (filePath) => {
24
- const isHigherTier =
25
- filePath.includes("tier-2-usage") || filePath.includes("tier-3-components");
26
- return isHigherTier;
27
- };
28
-
29
- /**
30
- * Transform shadow tokens
31
- * 1) Used to transform the individual shadow tokens into a single box-shadow-sm, box-shadow-md, etc. with x, y, blur, spread, and color concatenated
32
- */
33
- const transformShadowTokens = (dictionary, size, themeTokens) => {
34
- const shadowProps = dictionary.allTokens.filter(
35
- (p) =>
36
- isHigherTierToken(p.filePath) &&
37
- p.path[0] === "box-shadow" &&
38
- p.path[1] === size,
39
- );
40
-
41
- const x = shadowProps.find((p) => p.path[2] === "x")?.value || "0px";
42
- const y = shadowProps.find((p) => p.path[2] === "y")?.value || "0px";
43
- const blur = shadowProps.find((p) => p.path[2] === "blur")?.value || "0px";
44
- const spread =
45
- shadowProps.find((p) => p.path[2] === "spread")?.value || "0px";
46
- const color =
47
- shadowProps.find((p) => p.path[2] === "color")?.value || "transparent";
48
-
49
- /* 1 */
50
- themeTokens.push(
51
- ` --g-theme-box-shadow-${size}: ${x} ${y} ${blur} ${spread} ${color};`,
52
- );
53
- };
54
-
55
- /**
56
- * Transform line height tokens
57
- * 1) Used to transform the line height tokens to a unitless value for CSS by dividing the line height by the font size
58
- */
59
- const transformLineHeight = (
60
- dictionary,
61
- prop,
62
- outputArray,
63
- formatTokenName,
64
- ) => {
65
- const cleanPath = prop.path
66
- .map((segment) =>
67
- segment.startsWith("@") ? segment.substring(1) : segment,
68
- )
69
- .filter((segment) => segment !== "")
70
- .join("-");
71
-
72
- // For tier-1 tokens (typography.line-height.16), find matching font-size (typography.font-size.16)
73
- // For tier-2/3 tokens (typography.headline-lg.line-height), find matching font-size (typography.headline-lg.font-size)
74
- const isTier1 =
75
- prop.path.length === 3 &&
76
- prop.path[0] === "typography" &&
77
- prop.path[1] === "line-height";
78
- let fontSizePath;
79
- if (isTier1) {
80
- // Tier-1: typography.line-height.16 -> typography.font-size.16
81
- fontSizePath = ["typography", "font-size", prop.path[2]];
82
- } else {
83
- // Tier-2/3: typography.headline-lg.line-height -> typography.headline-lg.font-size
84
- fontSizePath = [...prop.path.slice(0, -1), "font-size"];
85
- }
86
-
87
- const fontSizeProp = dictionary.allTokens.find(
88
- (p) => p.path.join(".") === fontSizePath.join("."),
89
- );
90
-
91
- // Parse line-height value to pixels
92
- let lineHeightPx;
93
- if (prop.value.endsWith("px")) {
94
- lineHeightPx = parseFloat(prop.value.replace("px", ""));
95
- } else if (prop.value.endsWith("rem")) {
96
- lineHeightPx = parseFloat(prop.value.replace("rem", "")) * 16;
97
- } else {
98
- lineHeightPx = parseFloat(prop.value);
99
- }
100
-
101
- if (fontSizeProp) {
102
- // Found matching font-size - use it for calculation
103
- let fontSizePx;
104
- if (fontSizeProp.value.endsWith("px")) {
105
- fontSizePx = parseFloat(fontSizeProp.value.replace("px", ""));
106
- } else if (fontSizeProp.value.endsWith("rem")) {
107
- fontSizePx = parseFloat(fontSizeProp.value.replace("rem", "")) * 16;
108
- } else {
109
- fontSizePx = parseFloat(fontSizeProp.value);
110
- }
111
-
112
- if (fontSizePx > 0) {
113
- const unitlessValue = (lineHeightPx / fontSizePx).toFixed(2);
114
- outputArray.push(
115
- ` ${formatTokenName(cleanPath, prop)}: ${unitlessValue};`,
116
- );
117
- return;
118
- }
119
- } else if (isTier1 && lineHeightPx > 0) {
120
- // For tier-1 tokens without matching font-size, use 16px as base font-size
121
- const BASE_FONT_SIZE = 16;
122
- const unitlessValue = (lineHeightPx / BASE_FONT_SIZE).toFixed(2);
123
- outputArray.push(
124
- ` ${formatTokenName(cleanPath, prop)}: ${unitlessValue};`,
125
- );
126
- return;
127
- }
128
-
129
- // Fallback: output as-is if we can't calculate
130
- outputArray.push(` ${formatTokenName(cleanPath, prop)}: ${prop.value};`);
131
- };
132
-
133
- /**
134
- * Format variables
135
- * 1) Used to format the inner contents of the :root or .[theme-name] ruleset
136
- */
137
- const formatVariables = (dictionary) => {
138
- const processedShadows = new Set();
139
- const tier1Tokens = [];
140
- const themeTokens = [];
141
-
142
- /**
143
- * Format token global prefix and tier 2/3 identifier
144
- * 1) If the token is from tier-2 or tier-3, prefix it with `g-theme-`
145
- * 2) Otherwise, prefix it with `g-`
146
- */
147
- const formatTokenName = (cleanPath, prop) => {
148
- if (isHigherTierToken(prop.filePath)) {
149
- return `--g-theme-${cleanPath}`;
150
- }
151
- return `--g-${cleanPath}`;
152
- };
153
-
154
- /**
155
- * Get all box-shadow values from tier 2/3
156
- * 1) Used to determine which box-shadow values to transform into a single box-shadow-sm, box-shadow-md, etc.
157
- */
158
- const shadowSizes = dictionary.tokens.shadow
159
- ? Object.keys(dictionary.tokens.shadow)
160
- .map((key) => key.split("-")[0])
161
- .filter((value, index, self) => self.indexOf(value) === index) // Get unique sizes
162
- : [];
163
-
164
- /**
165
- * Iterate over all tokens and format them
166
- *
167
- */
168
- dictionary.allTokens.forEach((prop) => {
169
- /**
170
- * 1) Always include z-index and size tokens from core
171
- */
172
- if (prop.path[0] === "z-index") {
173
- const cleanPath = prop.path
174
- .map((segment) =>
175
- segment.startsWith("@") ? segment.substring(1) : segment,
176
- )
177
- .filter((segment) => segment !== "")
178
- .join("-");
179
- tier1Tokens.push(` ${formatTokenName(cleanPath, prop)}: ${prop.value};`);
180
- return;
181
- }
182
-
183
- /**
184
- * Handle box-shadow token transformations
185
- * If the token is from tier-2 or tier-3 and is a box-shadow, transform it into a single box-shadow-sm, box-shadow-md, etc.
186
- */
187
- if (
188
- isHigherTierToken(prop.filePath) &&
189
- prop.path[0] === "box-shadow" &&
190
- shadowSizes.includes(prop.path[1])
191
- ) {
192
- const size = prop.path[1];
193
- if (processedShadows.has(size)) return;
194
- processedShadows.add(size);
195
- transformShadowTokens(dictionary, size, themeTokens);
196
- } else if (
197
- prop.path[0] === "typography" &&
198
- prop.path.includes("line-height")
199
- ) {
200
- /**
201
- * Handle line heights in typography (both tier-1 and tier-2/3)
202
- * 1) Transform line-height tokens to unitless values by dividing by font-size
203
- */
204
- const outputArray = isHigherTierToken(prop.filePath)
205
- ? themeTokens
206
- : tier1Tokens;
207
- transformLineHeight(dictionary, prop, outputArray, formatTokenName);
208
- } else if (!prop.path.includes("box-shadow") || prop.path.length > 3) {
209
- /**
210
- * Handle all other properties
211
- * 1) If the token is not a box-shadow or typography token, format it as a normal token
212
- */
213
- const cleanPath = prop.path
214
- .map((segment) =>
215
- segment.startsWith("@") ? segment.substring(1) : segment,
216
- )
217
- .filter((segment) => segment !== "")
218
- .join("-");
219
-
220
- const token = ` ${formatTokenName(cleanPath, prop)}: ${prop.value};`;
221
- if (isHigherTierToken(prop.filePath)) {
222
- themeTokens.push(token);
223
- } else {
224
- tier1Tokens.push(token);
225
- }
226
- }
227
- });
228
-
229
- return [...new Set([...tier1Tokens, ...themeTokens])].join("\n");
230
- };
231
-
232
- /**
233
- * Transform shadow tokens for JSON format
234
- * Combines individual shadow properties into a single value
235
- */
236
- const transformShadowTokensJSON = (dictionary, size) => {
237
- const shadowProps = dictionary.allTokens.filter(
238
- (p) =>
239
- isHigherTierToken(p.filePath) &&
240
- p.path[0] === "box-shadow" &&
241
- p.path[1] === size,
242
- );
243
-
244
- const x = shadowProps.find((p) => p.path[2] === "x")?.value || "0px";
245
- const y = shadowProps.find((p) => p.path[2] === "y")?.value || "0px";
246
- const blur = shadowProps.find((p) => p.path[2] === "blur")?.value || "0px";
247
- const spread =
248
- shadowProps.find((p) => p.path[2] === "spread")?.value || "0px";
249
- const color =
250
- shadowProps.find((p) => p.path[2] === "color")?.value || "transparent";
251
-
252
- return `${x} ${y} ${blur} ${spread} ${color}`;
253
- };
254
-
255
- /**
256
- * Generate a Theme-Specific Config
257
- * This accepts a theme parameter, which is used to control which set of
258
- * tokens to compile, and to define theme-specific compiled output.
259
- * @param {string} theme
260
- */
261
- const getStyleDictionaryConfig = (theme) => {
262
- // Register the JSON formatter
263
- StyleDictionary.registerFormat({
264
- name: "json/flat/custom",
265
- format: function (dictionary) {
266
- const transformedTokens = {};
267
-
268
- /**
269
- * Get all box-shadow values from tier 2/3
270
- * 1) Used to determine which box-shadow values to transform into a single box-shadow-sm, box-shadow-md, etc.
271
- */
272
- const shadowSizes = dictionary.tokens.shadow
273
- ? Object.keys(dictionary.tokens.shadow)
274
- .map((key) => key.split("-")[0])
275
- .filter((value, index, self) => self.indexOf(value) === index) // Get unique sizes
276
- : [];
277
-
278
- // Process regular tokens
279
- dictionary.allTokens.forEach((token) => {
280
- // Remove the isHigherTierToken check to include all tokens
281
- if (token.path[0] === "box-shadow" && token.path.length > 2) return;
282
- const prefix = isHigherTierToken(token.filePath) ? "g-theme-" : "g-";
283
- transformedTokens[`${prefix}${token.path.join("-")}`] = token.value;
284
- });
285
-
286
- // Process shadow tokens
287
- shadowSizes.forEach((size) => {
288
- transformedTokens[`g-theme-box-shadow-${size}`] =
289
- transformShadowTokensJSON(dictionary, size);
290
- });
291
-
292
- return JSON.stringify(transformedTokens, null, 2);
293
- },
294
- });
295
-
296
- /**
297
- * Register the CSS formatter
298
- * 1) Used to format the inner contents of the .[theme-name] ruleset for Storybook only or if you want to define tokens using a theme name
299
- */
300
- StyleDictionary.registerFormat({
301
- name: "css/variables-themed",
302
- format: function (dictionary) {
303
- return `.${theme} {\n${formatVariables(dictionary)}\n}\n`;
304
- },
305
- });
306
-
307
- /**
308
- * Define the base pixel value for rem conversion
309
- */
310
- const BASE_FONT_SIZE = 16; // Typically 16px = 1rem
311
-
312
- /**
313
- * Register the size/px-to-rem transform
314
- * 1) Used to convert px values to rem values
315
- * 2) Match only properties with px values
316
- * 3) Only transform if it's a valid px value
317
- */
318
- StyleDictionary.registerTransform({
319
- name: "size/px-to-rem",
320
- type: "value",
321
- matcher: function (prop) {
322
- /* 2 */
323
- return (
324
- prop &&
325
- prop.value &&
326
- typeof prop.value === "string" &&
327
- prop.value.endsWith("px")
328
- );
329
- },
330
- transform: function (prop) {
331
- if (!prop || !prop.value) return prop.value;
332
- /* 3 */
333
- const pxValue = prop.value.trim();
334
- if (!pxValue.endsWith("px")) return prop.value;
335
-
336
- const pixels = parseFloat(pxValue);
337
- if (isNaN(pixels)) return prop.value;
338
-
339
- const remValue = Number((pixels / BASE_FONT_SIZE).toFixed(4)).toString();
340
- return `${remValue}rem`;
341
- },
342
- });
343
-
344
- /**
345
- * Register the CSS formatter
346
- * 1) Used to format the inner contents of the :root ruleset for Storybook only or if you want to define tokens with theme prefix
347
- */
348
- StyleDictionary.registerFormat({
349
- name: "css/custom-variables",
350
- format: function (dictionary) {
351
- return `:root {\n${formatVariables(dictionary)}\n}`;
352
- },
353
- });
354
-
355
- /**
356
- * Register the name/theme-prefix transform
357
- * 1) Used to prefix the token name with the theme name
358
- * 2) If the token is from tier-2 or tier-3, prefix it with `GTheme` for JS
359
- * 3) Otherwise, prefix it with `G` for JS
360
- */
361
- StyleDictionary.registerTransform({
362
- name: "name/theme-prefix",
363
- type: "name",
364
- transform: function (token) {
365
- const cleanPath = token.path
366
- .map((segment) =>
367
- segment.startsWith("@") ? segment.substring(1) : segment,
368
- )
369
- .filter((segment) => segment !== "")
370
- .join("-");
371
-
372
- /* 2 */
373
- if (isHigherTierToken(token.filePath)) {
374
- return `GTheme${cleanPath
375
- .split("-")
376
- .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
377
- .join("")}`;
378
- }
379
-
380
- /* 3 */
381
- return `G${cleanPath
382
- .split("-")
383
- .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
384
- .join("")}`;
385
- },
386
- });
387
-
388
- /**
389
- * Register the custom/css transform group
390
- */
391
- StyleDictionary.registerTransformGroup({
392
- name: "custom/css",
393
- transforms: ["attribute/cti", "name/kebab", "size/px-to-rem"],
394
- });
395
-
396
- /**
397
- * Register the custom/js transform group
398
- */
399
- StyleDictionary.registerTransformGroup({
400
- name: "custom/js",
401
- transforms: ["attribute/cti", "name/theme-prefix", "size/px-to-rem"],
402
- });
403
-
404
- /**
405
- * Define the config
406
- * 1) Used to define the platforms, prefixes, etc. to build the tokens with/for
407
- */
408
- const config = {
409
- source: [`./tokens/core/**/*.json`, `./tokens/${theme}/**/*.json`],
410
- log: {
411
- // Set the log level to show errors, warnings, and info messages
412
- verbosity: "verbose",
413
- },
414
- platforms: {
415
- ts: {
416
- transformGroup: "custom/js",
417
- prefix: "G",
418
- buildPath: `./dist/js/${theme}/`,
419
- filter: {
420
- attributes: {
421
- category: "theme",
422
- },
423
- },
424
- files: [
425
- {
426
- destination: "style-dictionary.js",
427
- format: "javascript/es6",
428
- },
429
- {
430
- destination: "style-dictionary.d.ts",
431
- format: "typescript/es6-declarations",
432
- },
433
- ],
434
- },
435
- css: {
436
- transformGroup: "custom/css",
437
- prefix: "g",
438
- buildPath: `./dist/css/${theme}/`,
439
- files: [
440
- {
441
- destination: "tokens.css",
442
- format: "css/custom-variables",
443
- },
444
- {
445
- destination: `${theme}.css`,
446
- format: "css/variables-themed",
447
- },
448
- ],
449
- },
450
- json: {
451
- transformGroup: "custom/css",
452
- prefix: "g",
453
- buildPath: `./dist/json/${theme}/`,
454
- files: [
455
- {
456
- destination: "tokens.json",
457
- format: "json/flat/custom",
458
- },
459
- ],
460
- },
461
- },
462
- };
463
-
464
- return config;
465
- };
466
-
467
- /**
468
- * Build the tokens
469
- * 1) If no theme is specified, build all themes
470
- * 2) Otherwise, build the specified theme
471
- */
472
- if (!theme) {
473
- console.log("🚧 No theme specified, building all themes...");
474
- AVAILABLE_THEMES.forEach((themeName) => {
475
- console.log(`\n🏗️ Building ${themeName.toUpperCase()} theme`);
476
- const themeConfig = getStyleDictionaryConfig(themeName);
477
- const StyleDictionaryExtended = new StyleDictionary(themeConfig);
478
- StyleDictionaryExtended.buildAllPlatforms();
479
- });
480
- } else {
481
- console.log(`🚧 Building ${theme.toUpperCase()} theme`);
482
- const config = getStyleDictionaryConfig(theme);
483
- const StyleDictionaryExtended = new StyleDictionary(config);
484
- StyleDictionaryExtended.buildAllPlatforms();
485
- }
package/demo.html DELETED
@@ -1,171 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Style Dictionary Demo</title>
7
- <link rel="stylesheet" href="./dist/css/grantcodes/tokens.css" />
8
- <style>
9
- .color {
10
- display: flex;
11
- align-items: center;
12
- justify-content: center;
13
- padding: 1rem;
14
- min-height: 12rem;
15
- }
16
- </style>
17
- </head>
18
- <body>
19
- <h1>Style Dictionary Demo</h1>
20
- <p>This is a demo of the Style Dictionary design tokens.</p>
21
-
22
- <h2>Colors</h2>
23
- <span
24
- class="color"
25
- style="
26
- background-color: var(--g-theme-color-background-default);
27
- color: var(--g-theme-color-content-default);
28
- "
29
- >Default</span
30
- >
31
- <span
32
- class="color"
33
- style="
34
- background-color: var(--g-theme-color-background-default-hover);
35
- color: var(--g-theme-color-content-default-hover);
36
- "
37
- >Default Hover</span
38
- >
39
- <span
40
- class="color"
41
- style="
42
- background-color: var(--g-theme-color-background-subtle);
43
- color: var(--g-theme-color-content-subtle);
44
- "
45
- >Subtle</span
46
- >
47
- <span
48
- class="color"
49
- style="
50
- background-color: var(--g-theme-color-background-subtle-hover);
51
- color: var(--g-theme-color-content-subtle-hover);
52
- "
53
- >Subtle Hover</span
54
- >
55
- <span
56
- class="color"
57
- style="
58
- background-color: var(--g-theme-color-background-knockout);
59
- color: var(--g-theme-color-content-knockout);
60
- "
61
- >Knockout</span
62
- >
63
- <span
64
- class="color"
65
- style="
66
- background-color: var(--g-theme-color-background-brand);
67
- color: var(--g-theme-color-content-brand);
68
- "
69
- >Brand</span
70
- >
71
- <span
72
- class="color"
73
- style="
74
- background-color: var(--g-theme-color-background-brand-hover);
75
- color: var(--g-theme-color-content-brand-hover);
76
- "
77
- >Brand Hover</span
78
- >
79
- <span
80
- class="color"
81
- style="
82
- background-color: var(--g-theme-color-background-brand-knockout);
83
- color: var(--g-theme-color-content-brand-knockout);
84
- "
85
- >Brand Knockout</span
86
- >
87
- <span
88
- class="color"
89
- style="
90
- background-color: var(--g-theme-color-background-brand-knockout-hover);
91
- color: var(--g-theme-color-content-brand-knockout-hover);
92
- "
93
- >Brand Knockout Hover</span
94
- >
95
- <span
96
- class="color"
97
- style="
98
- background-color: var(--g-theme-color-background-utility-error);
99
- color: var(--g-theme-color-content-utility-error);
100
- "
101
- >Utility Error</span
102
- >
103
- <span
104
- class="color"
105
- style="
106
- background-color: var(--g-theme-color-background-utility-warning);
107
- color: var(--g-theme-color-content-utility-warning);
108
- "
109
- >Utility Warning</span
110
- >
111
- <span
112
- class="color"
113
- style="
114
- background-color: var(--g-theme-color-background-utility-success);
115
- color: var(--g-theme-color-content-utility-success);
116
- "
117
- >Utility Success</span
118
- >
119
- <span
120
- class="color"
121
- style="
122
- background-color: var(--g-theme-color-background-utility-info);
123
- color: var(--g-theme-color-content-utility-info);
124
- "
125
- >Utility Info</span
126
- >
127
- <span
128
- class="color"
129
- style="
130
- background-color: var(--g-theme-color-background-disabled);
131
- color: var(--g-theme-color-content-disabled);
132
- "
133
- >Disabled</span
134
- >
135
- <span
136
- class="color"
137
- style="
138
- background-color: var(--g-theme-color-background-transparent);
139
- color: var(--g-theme-color-content-transparent);
140
- "
141
- >Transparent</span
142
- >
143
- <span
144
- class="color"
145
- style="
146
- background-color: var(--g-theme-color-background-transparent-strong);
147
- color: var(--g-theme-color-content-transparent-strong);
148
- "
149
- >Transparent Strong</span
150
- >
151
-
152
- <h2>Typography</h2>
153
- <p style="font: var(--g-theme-typography-display-default)">
154
- Display Default
155
- </p>
156
- <p style="font: var(--g-theme-typography-display-sm)">Display Small</p>
157
- <p style="font: var(--g-theme-typography-headline-lg)">Headline Large</p>
158
- <p style="font: var(--g-theme-typography-headline-default)">
159
- Headline Default
160
- </p>
161
- <p style="font: var(--g-theme-typography-headline-sm)">Headline Small</p>
162
- <p style="font: var(--g-theme-typography-title-lg)">Title Large</p>
163
- <p style="font: var(--g-theme-typography-title-default)">Title Default</p>
164
- <p style="font: var(--g-theme-typography-title-sm)">Title Small</p>
165
- <p style="font: var(--g-theme-typography-label-lg)">Label Large</p>
166
- <p style="font: var(--g-theme-typography-label-default)">Label Default</p>
167
- <p style="font: var(--g-theme-typography-label-sm)">Label Small</p>
168
- <p style="font: var(--g-theme-typography-body-lg)">Body Large</p>
169
- <p style="font: var(--g-theme-typography-body-default)">Body Default</p>
170
- </body>
171
- </html>
@@ -1,13 +0,0 @@
1
- /**
2
- * Get a scale of lightness values
3
- * @param {number} min - The minimum lightness value
4
- * @param {number} max - The maximum lightness value
5
- * @param {number} steps - The number of steps in the scale
6
- * @returns {number[]} - The lightness steps
7
- */
8
- const getLightnessScale = (min = 26, max = 97, steps = 9) => {
9
- const step = (max - min) / steps;
10
- return Array.from({ length: steps }, (_, i) => Math.round(min + step * i));
11
- };
12
-
13
- export { getLightnessScale };