@diskette/palette 0.9.2 → 0.11.0

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 (72) hide show
  1. package/README.md +0 -176
  2. package/dist/cli.d.ts +1 -0
  3. package/dist/cli.js +135 -0
  4. package/dist/colors/amber.d.ts +1 -0
  5. package/dist/colors/amber.js +1 -0
  6. package/dist/colors/black-alpha.d.ts +1 -0
  7. package/dist/colors/black-alpha.js +1 -0
  8. package/dist/colors/blue.d.ts +1 -0
  9. package/dist/colors/blue.js +1 -0
  10. package/dist/colors/bronze.d.ts +1 -0
  11. package/dist/colors/bronze.js +1 -0
  12. package/dist/colors/brown.d.ts +1 -0
  13. package/dist/colors/brown.js +1 -0
  14. package/dist/colors/crimson.d.ts +1 -0
  15. package/dist/colors/crimson.js +1 -0
  16. package/dist/colors/cyan.d.ts +1 -0
  17. package/dist/colors/cyan.js +1 -0
  18. package/dist/colors/gold.d.ts +1 -0
  19. package/dist/colors/gold.js +1 -0
  20. package/dist/colors/grass.d.ts +1 -0
  21. package/dist/colors/grass.js +1 -0
  22. package/dist/colors/gray.d.ts +1 -0
  23. package/dist/colors/gray.js +1 -0
  24. package/dist/colors/green.d.ts +1 -0
  25. package/dist/colors/green.js +1 -0
  26. package/dist/colors/indigo.d.ts +1 -0
  27. package/dist/colors/indigo.js +1 -0
  28. package/dist/colors/iris.d.ts +1 -0
  29. package/dist/colors/iris.js +1 -0
  30. package/dist/colors/jade.d.ts +1 -0
  31. package/dist/colors/jade.js +1 -0
  32. package/dist/colors/lime.d.ts +1 -0
  33. package/dist/colors/lime.js +1 -0
  34. package/dist/colors/mauve.d.ts +1 -0
  35. package/dist/colors/mauve.js +1 -0
  36. package/dist/colors/mint.d.ts +1 -0
  37. package/dist/colors/mint.js +1 -0
  38. package/dist/colors/olive.d.ts +1 -0
  39. package/dist/colors/olive.js +1 -0
  40. package/dist/colors/orange.d.ts +1 -0
  41. package/dist/colors/orange.js +1 -0
  42. package/dist/colors/pink.d.ts +1 -0
  43. package/dist/colors/pink.js +1 -0
  44. package/dist/colors/plum.d.ts +1 -0
  45. package/dist/colors/plum.js +1 -0
  46. package/dist/colors/purple.d.ts +1 -0
  47. package/dist/colors/purple.js +1 -0
  48. package/dist/colors/red.d.ts +1 -0
  49. package/dist/colors/red.js +1 -0
  50. package/dist/colors/ruby.d.ts +1 -0
  51. package/dist/colors/ruby.js +1 -0
  52. package/dist/colors/sage.d.ts +1 -0
  53. package/dist/colors/sage.js +1 -0
  54. package/dist/colors/sand.d.ts +1 -0
  55. package/dist/colors/sand.js +1 -0
  56. package/dist/colors/sky.d.ts +1 -0
  57. package/dist/colors/sky.js +1 -0
  58. package/dist/colors/slate.d.ts +1 -0
  59. package/dist/colors/slate.js +1 -0
  60. package/dist/colors/teal.d.ts +1 -0
  61. package/dist/colors/teal.js +1 -0
  62. package/dist/colors/tomato.d.ts +1 -0
  63. package/dist/colors/tomato.js +1 -0
  64. package/dist/colors/violet.d.ts +1 -0
  65. package/dist/colors/violet.js +1 -0
  66. package/dist/colors/white-alpha.d.ts +27 -26
  67. package/dist/colors/white-alpha.js +1 -0
  68. package/dist/colors/yellow.d.ts +1 -0
  69. package/dist/colors/yellow.js +1 -0
  70. package/dist/index.d.ts +31 -0
  71. package/dist/types.d.ts +2 -0
  72. package/package.json +7 -1
package/README.md CHANGED
@@ -224,182 +224,6 @@ css.semantic(name: string, config: ColorConfig): string
224
224
 
225
225
  </details>
226
226
 
227
- ## Examples
228
-
229
- ### Generate a Complete CSS File
230
-
231
- ```ts
232
- // scripts/generate-css.ts
233
- import { writeFileSync } from 'node:fs'
234
- import { css, colors } from '@diskette/palette'
235
- import { blackAlpha, whiteAlpha } from '@diskette/palette/colors'
236
-
237
- let output = ''
238
-
239
- // Generate scales for all colors
240
- for (const color of colors) {
241
- output += css.scale('light', color)
242
- output += css.scale('lightAlpha', color)
243
- output += css.scale('dark', color)
244
- output += css.scale('darkAlpha', color)
245
- }
246
-
247
- // Generate alpha colors
248
- output += css.alpha(blackAlpha)
249
- output += css.alpha(whiteAlpha)
250
-
251
- writeFileSync('dist/colors.css', output)
252
- ```
253
-
254
- ### Generate CSS for Selected Colors
255
-
256
- ```ts
257
- // scripts/generate-theme.ts
258
- import { writeFileSync } from 'node:fs'
259
- import { css } from '@diskette/palette'
260
- import blue from '@diskette/palette/colors/blue'
261
- import gray from '@diskette/palette/colors/gray'
262
-
263
- const output = [
264
- // Base scales
265
- css.scale('light', blue),
266
- css.scale('dark', blue),
267
- css.scale('light', gray),
268
- css.scale('dark', gray),
269
-
270
- // Semantic tokens
271
- css.semantic('blue', blue),
272
- css.semantic('gray', gray),
273
- ].join('\n')
274
-
275
- writeFileSync('src/styles/theme.css', output)
276
- ```
277
-
278
- ### Generate CSS with Custom Build Script
279
-
280
- ```ts
281
- // build-colors.ts
282
- import { writeFileSync, mkdirSync } from 'node:fs'
283
- import { css, colors } from '@diskette/palette'
284
-
285
- mkdirSync('dist', { recursive: true })
286
-
287
- // Generate individual files per color
288
- for (const color of colors) {
289
- const name = Object.keys(color.srgb.light)[0].replace(/\d+$/, '')
290
-
291
- const content = [
292
- css.scale('light', color),
293
- css.scale('dark', color),
294
- css.semantic(name, color),
295
- ].join('\n')
296
-
297
- writeFileSync(`dist/${name}.css`, content)
298
- }
299
-
300
- // Generate combined file
301
- let combined = ''
302
- for (const color of colors) {
303
- const name = Object.keys(color.srgb.light)[0].replace(/\d+$/, '')
304
- combined += css.scale('light', color)
305
- combined += css.scale('dark', color)
306
- combined += css.semantic(name, color)
307
- }
308
- writeFileSync('dist/all-colors.css', combined)
309
- ```
310
-
311
- ### Use with vanilla-extract
312
-
313
- ```ts
314
- // src/styles/colors.css.ts
315
- import { createGlobalTheme } from '@vanilla-extract/css'
316
- import blue from '@diskette/palette/colors/blue'
317
- import gray from '@diskette/palette/colors/gray'
318
-
319
- // Create CSS variables from the palette
320
- createGlobalTheme(':root', {
321
- colors: {
322
- blue1: blue.srgb.light.blue1,
323
- blue2: blue.srgb.light.blue2,
324
- blue3: blue.srgb.light.blue3,
325
- // ... etc
326
- blue9: blue.srgb.light.blue9,
327
- blue10: blue.srgb.light.blue10,
328
- blue11: blue.srgb.light.blue11,
329
- blue12: blue.srgb.light.blue12,
330
- gray1: gray.srgb.light.gray1,
331
- // ... etc
332
- },
333
- })
334
-
335
- // For dark mode
336
- createGlobalTheme('.dark', {
337
- colors: {
338
- blue1: blue.srgb.dark.blue1,
339
- blue2: blue.srgb.dark.blue2,
340
- // ... etc
341
- },
342
- })
343
- ```
344
-
345
- ### Generate Semantic Tokens Only
346
-
347
- ```ts
348
- // scripts/semantic-tokens.ts
349
- import { writeFileSync } from 'node:fs'
350
- import { css, colors } from '@diskette/palette'
351
-
352
- let output = ''
353
-
354
- for (const color of colors) {
355
- // Extract color name from first key (e.g., "blue1" -> "blue")
356
- const name = Object.keys(color.srgb.light)[0].replace(/\d+$/, '')
357
- output += css.semantic(name, color)
358
- }
359
-
360
- writeFileSync('dist/semantic.css', output)
361
- ```
362
-
363
- ### Access Colors Directly in JavaScript
364
-
365
- ```ts
366
- import blue from '@diskette/palette/colors/blue'
367
-
368
- // Use in CSS-in-JS libraries
369
- const styles = {
370
- button: {
371
- backgroundColor: blue.srgb.light.blue9,
372
- color: blue.contrast,
373
- '&:hover': {
374
- backgroundColor: blue.srgb.light.blue10,
375
- },
376
- },
377
- }
378
-
379
- // Use P3 colors for wider gamut displays
380
- const p3Styles = {
381
- button: {
382
- backgroundColor: blue.p3.light.blue9,
383
- },
384
- }
385
-
386
- // Access surface colors for overlays
387
- const overlay = {
388
- backgroundColor: blue.surface.srgb.light, // '#f1f9ffcc'
389
- }
390
- ```
391
-
392
- ### NPM Script Integration
393
-
394
- ```json
395
- {
396
- "scripts": {
397
- "build:css": "tsx scripts/generate-css.ts",
398
- "build": "pnpm build:css && vite build"
399
- }
400
- }
401
- ```
402
-
403
227
  ## Credits
404
228
 
405
229
  Color values are derived from [Radix Colors](https://www.radix-ui.com/colors) by [WorkOS](https://workos.com/).
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,135 @@
1
+ import * as p from '@clack/prompts';
2
+ import { mkdirSync, statSync, writeFileSync } from 'node:fs';
3
+ import { resolve } from 'node:path';
4
+ import { blackAlpha, whiteAlpha } from "./colors/index.js";
5
+ import { colors, css, grayColors } from "./index.js";
6
+ function colorOptions() {
7
+ return colors.map((color) => {
8
+ const option = {
9
+ value: color.name,
10
+ label: color.name,
11
+ };
12
+ if (grayColors.includes(color.name)) {
13
+ option.hint = 'gray';
14
+ }
15
+ return option;
16
+ });
17
+ }
18
+ async function askOutputDir(message) {
19
+ const outputDir = await p.text({
20
+ message,
21
+ validate(value) {
22
+ if (!value) {
23
+ return 'Please enter a path';
24
+ }
25
+ try {
26
+ const stat = statSync(resolve(process.cwd(), value));
27
+ if (!stat.isDirectory()) {
28
+ return 'Path must be a directory, not a file';
29
+ }
30
+ }
31
+ catch { }
32
+ },
33
+ });
34
+ if (p.isCancel(outputDir)) {
35
+ p.cancel('Operation cancelled.');
36
+ process.exit(0);
37
+ }
38
+ return outputDir;
39
+ }
40
+ async function main() {
41
+ p.intro('Palette CSS Generator');
42
+ // --- Color Scales ---
43
+ const scaleMode = await p.select({
44
+ message: 'Which color scales do you want to generate?',
45
+ options: [
46
+ { value: 'all', label: 'All colors', hint: `${colors.length} colors` },
47
+ { value: 'select', label: 'Select specific colors' },
48
+ ],
49
+ });
50
+ if (p.isCancel(scaleMode)) {
51
+ p.cancel('Operation cancelled.');
52
+ process.exit(0);
53
+ }
54
+ let scaleColors = colors;
55
+ if (scaleMode === 'select') {
56
+ const scaleChoices = await p.autocompleteMultiselect({
57
+ message: 'Select colors for scales:',
58
+ options: colorOptions(),
59
+ required: true,
60
+ });
61
+ if (p.isCancel(scaleChoices)) {
62
+ p.cancel('Operation cancelled.');
63
+ process.exit(0);
64
+ }
65
+ scaleColors = colors.filter((c) => scaleChoices.includes(c.name));
66
+ }
67
+ const scalesOutputDir = await askOutputDir('Output directory for color scales:');
68
+ // --- Semantic Tokens ---
69
+ const generateSemantic = await p.confirm({
70
+ message: 'Generate semantic tokens?',
71
+ });
72
+ if (p.isCancel(generateSemantic)) {
73
+ p.cancel('Operation cancelled.');
74
+ process.exit(0);
75
+ }
76
+ let semanticColors = colors;
77
+ let semanticOutputDir = null;
78
+ if (generateSemantic) {
79
+ const semanticMode = await p.select({
80
+ message: 'Which colors for semantic tokens?',
81
+ options: [
82
+ { value: 'all', label: 'All colors', hint: `${colors.length} colors` },
83
+ { value: 'select', label: 'Select specific colors' },
84
+ ],
85
+ });
86
+ if (p.isCancel(semanticMode)) {
87
+ p.cancel('Operation cancelled.');
88
+ process.exit(0);
89
+ }
90
+ if (semanticMode === 'select') {
91
+ const semanticChoices = await p.autocompleteMultiselect({
92
+ message: 'Select colors for semantic tokens:',
93
+ options: colorOptions(),
94
+ required: true,
95
+ });
96
+ if (p.isCancel(semanticChoices)) {
97
+ p.cancel('Operation cancelled.');
98
+ process.exit(0);
99
+ }
100
+ semanticColors = colors.filter((c) => semanticChoices.includes(c.name));
101
+ }
102
+ semanticOutputDir = await askOutputDir('Output directory for semantic tokens:');
103
+ }
104
+ // --- Generate Files ---
105
+ const s = p.spinner();
106
+ s.start('Generating CSS files...');
107
+ // Generate color scales
108
+ const scalesPath = resolve(process.cwd(), scalesOutputDir);
109
+ mkdirSync(scalesPath, { recursive: true });
110
+ for (const color of scaleColors) {
111
+ const name = color.name;
112
+ writeFileSync(`${scalesPath}/${name}.css`, css.scale('light', color));
113
+ writeFileSync(`${scalesPath}/${name}-alpha.css`, css.scale('lightAlpha', color));
114
+ writeFileSync(`${scalesPath}/${name}-dark.css`, css.scale('dark', color));
115
+ writeFileSync(`${scalesPath}/${name}-dark-alpha.css`, css.scale('darkAlpha', color));
116
+ }
117
+ // Always generate alpha overlay files
118
+ writeFileSync(`${scalesPath}/black-alpha.css`, css.alpha(blackAlpha));
119
+ writeFileSync(`${scalesPath}/white-alpha.css`, css.alpha(whiteAlpha));
120
+ // Generate semantic tokens
121
+ if (generateSemantic && semanticOutputDir) {
122
+ const semanticPath = resolve(process.cwd(), semanticOutputDir);
123
+ mkdirSync(semanticPath, { recursive: true });
124
+ for (const color of semanticColors) {
125
+ writeFileSync(`${semanticPath}/${color.name}.css`, css.semantic(color.name, color));
126
+ }
127
+ }
128
+ s.stop();
129
+ let message = `Color scales saved to ${scalesPath}`;
130
+ if (semanticOutputDir) {
131
+ message += `\nSemantic tokens saved to ${resolve(process.cwd(), semanticOutputDir)}`;
132
+ }
133
+ p.outro(message);
134
+ }
135
+ main().catch(console.error);
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1412 0.1176 0.0784 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'amber',
127
128
  };
@@ -27,5 +27,6 @@ declare const _default: {
27
27
  blackA11: string;
28
28
  blackA12: string;
29
29
  };
30
+ name: string;
30
31
  };
31
32
  export default _default;
@@ -27,4 +27,5 @@ export default {
27
27
  blackA11: 'color(display-p3 0 0 0 / 0.9)',
28
28
  blackA12: 'color(display-p3 0 0 0 / 0.95)',
29
29
  },
30
+ name: 'black-alpha',
30
31
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0706 0.1255 0.2196 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'blue',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1412 0.1255 0.1176 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'bronze',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1412 0.1176 0.102 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'brown',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1647 0.0863 0.1176 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'crimson',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0784 0.1412 0.1725 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'cyan',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1412 0.1333 0.1098 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'gold',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.102 0.1333 0.102 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'grass',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1255 0.1255 0.1255 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'gray',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0941 0.1412 0.1098 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'green',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0941 0.1098 0.2196 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'indigo',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1098 0.102 0.2118 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'iris',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0863 0.149 0.1176 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'jade',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1098 0.1255 0.0784 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'lime',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1333 0.1255 0.1333 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'mauve',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0941 0.149 0.1412 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'mint',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1176 0.1255 0.1176 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'olive',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1412 0.1098 0.0706 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'orange',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1725 0.0784 0.149 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'pink',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1647 0.0863 0.1725 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'plum',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.149 0.0941 0.1961 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'purple',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1647 0.0863 0.0863 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'red',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1569 0.0941 0.1098 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'ruby',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1176 0.1255 0.1176 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'sage',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1255 0.1255 0.1255 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'sand',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0863 0.1333 0.2196 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'sky',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1176 0.1255 0.1333 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'slate',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.0863 0.149 0.1412 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'teal',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1569 0.0941 0.0784 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'tomato',
127
128
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1333 0.102 0.2118 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'violet',
127
128
  };
@@ -1,31 +1,32 @@
1
1
  declare const _default: {
2
- readonly srgb: {
3
- readonly whiteA1: "rgba(255, 255, 255, 0.05)";
4
- readonly whiteA2: "rgba(255, 255, 255, 0.1)";
5
- readonly whiteA3: "rgba(255, 255, 255, 0.15)";
6
- readonly whiteA4: "rgba(255, 255, 255, 0.2)";
7
- readonly whiteA5: "rgba(255, 255, 255, 0.3)";
8
- readonly whiteA6: "rgba(255, 255, 255, 0.4)";
9
- readonly whiteA7: "rgba(255, 255, 255, 0.5)";
10
- readonly whiteA8: "rgba(255, 255, 255, 0.6)";
11
- readonly whiteA9: "rgba(255, 255, 255, 0.7)";
12
- readonly whiteA10: "rgba(255, 255, 255, 0.8)";
13
- readonly whiteA11: "rgba(255, 255, 255, 0.9)";
14
- readonly whiteA12: "rgba(255, 255, 255, 0.95)";
2
+ srgb: {
3
+ whiteA1: string;
4
+ whiteA2: string;
5
+ whiteA3: string;
6
+ whiteA4: string;
7
+ whiteA5: string;
8
+ whiteA6: string;
9
+ whiteA7: string;
10
+ whiteA8: string;
11
+ whiteA9: string;
12
+ whiteA10: string;
13
+ whiteA11: string;
14
+ whiteA12: string;
15
15
  };
16
- readonly p3: {
17
- readonly whiteA1: "color(display-p3 1 1 1 / 0.05)";
18
- readonly whiteA2: "color(display-p3 1 1 1 / 0.1)";
19
- readonly whiteA3: "color(display-p3 1 1 1 / 0.15)";
20
- readonly whiteA4: "color(display-p3 1 1 1 / 0.2)";
21
- readonly whiteA5: "color(display-p3 1 1 1 / 0.3)";
22
- readonly whiteA6: "color(display-p3 1 1 1 / 0.4)";
23
- readonly whiteA7: "color(display-p3 1 1 1 / 0.5)";
24
- readonly whiteA8: "color(display-p3 1 1 1 / 0.6)";
25
- readonly whiteA9: "color(display-p3 1 1 1 / 0.7)";
26
- readonly whiteA10: "color(display-p3 1 1 1 / 0.8)";
27
- readonly whiteA11: "color(display-p3 1 1 1 / 0.9)";
28
- readonly whiteA12: "color(display-p3 1 1 1 / 0.95)";
16
+ p3: {
17
+ whiteA1: string;
18
+ whiteA2: string;
19
+ whiteA3: string;
20
+ whiteA4: string;
21
+ whiteA5: string;
22
+ whiteA6: string;
23
+ whiteA7: string;
24
+ whiteA8: string;
25
+ whiteA9: string;
26
+ whiteA10: string;
27
+ whiteA11: string;
28
+ whiteA12: string;
29
29
  };
30
+ name: string;
30
31
  };
31
32
  export default _default;
@@ -27,4 +27,5 @@ export default {
27
27
  whiteA11: 'color(display-p3 1 1 1 / 0.9)',
28
28
  whiteA12: 'color(display-p3 1 1 1 / 0.95)',
29
29
  },
30
+ name: 'white-alpha',
30
31
  };
@@ -124,5 +124,6 @@ declare const _default: {
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  };
128
129
  export default _default;
@@ -124,4 +124,5 @@ export default {
124
124
  dark: 'color(display-p3 0.1333 0.1176 0.0706 / 0.5)',
125
125
  },
126
126
  },
127
+ name: 'yellow',
127
128
  };
package/dist/index.d.ts CHANGED
@@ -124,6 +124,7 @@ export declare const colors: ({
124
124
  dark: string;
125
125
  };
126
126
  };
127
+ name: string;
127
128
  } | {
128
129
  srgb: {
129
130
  light: {
@@ -250,6 +251,7 @@ export declare const colors: ({
250
251
  dark: string;
251
252
  };
252
253
  };
254
+ name: string;
253
255
  } | {
254
256
  srgb: {
255
257
  light: {
@@ -376,6 +378,7 @@ export declare const colors: ({
376
378
  dark: string;
377
379
  };
378
380
  };
381
+ name: string;
379
382
  } | {
380
383
  srgb: {
381
384
  light: {
@@ -502,6 +505,7 @@ export declare const colors: ({
502
505
  dark: string;
503
506
  };
504
507
  };
508
+ name: string;
505
509
  } | {
506
510
  srgb: {
507
511
  light: {
@@ -628,6 +632,7 @@ export declare const colors: ({
628
632
  dark: string;
629
633
  };
630
634
  };
635
+ name: string;
631
636
  } | {
632
637
  srgb: {
633
638
  light: {
@@ -754,6 +759,7 @@ export declare const colors: ({
754
759
  dark: string;
755
760
  };
756
761
  };
762
+ name: string;
757
763
  } | {
758
764
  srgb: {
759
765
  light: {
@@ -880,6 +886,7 @@ export declare const colors: ({
880
886
  dark: string;
881
887
  };
882
888
  };
889
+ name: string;
883
890
  } | {
884
891
  srgb: {
885
892
  light: {
@@ -1006,6 +1013,7 @@ export declare const colors: ({
1006
1013
  dark: string;
1007
1014
  };
1008
1015
  };
1016
+ name: string;
1009
1017
  } | {
1010
1018
  srgb: {
1011
1019
  light: {
@@ -1132,6 +1140,7 @@ export declare const colors: ({
1132
1140
  dark: string;
1133
1141
  };
1134
1142
  };
1143
+ name: string;
1135
1144
  } | {
1136
1145
  srgb: {
1137
1146
  light: {
@@ -1258,6 +1267,7 @@ export declare const colors: ({
1258
1267
  dark: string;
1259
1268
  };
1260
1269
  };
1270
+ name: string;
1261
1271
  } | {
1262
1272
  srgb: {
1263
1273
  light: {
@@ -1384,6 +1394,7 @@ export declare const colors: ({
1384
1394
  dark: string;
1385
1395
  };
1386
1396
  };
1397
+ name: string;
1387
1398
  } | {
1388
1399
  srgb: {
1389
1400
  light: {
@@ -1510,6 +1521,7 @@ export declare const colors: ({
1510
1521
  dark: string;
1511
1522
  };
1512
1523
  };
1524
+ name: string;
1513
1525
  } | {
1514
1526
  srgb: {
1515
1527
  light: {
@@ -1636,6 +1648,7 @@ export declare const colors: ({
1636
1648
  dark: string;
1637
1649
  };
1638
1650
  };
1651
+ name: string;
1639
1652
  } | {
1640
1653
  srgb: {
1641
1654
  light: {
@@ -1762,6 +1775,7 @@ export declare const colors: ({
1762
1775
  dark: string;
1763
1776
  };
1764
1777
  };
1778
+ name: string;
1765
1779
  } | {
1766
1780
  srgb: {
1767
1781
  light: {
@@ -1888,6 +1902,7 @@ export declare const colors: ({
1888
1902
  dark: string;
1889
1903
  };
1890
1904
  };
1905
+ name: string;
1891
1906
  } | {
1892
1907
  srgb: {
1893
1908
  light: {
@@ -2014,6 +2029,7 @@ export declare const colors: ({
2014
2029
  dark: string;
2015
2030
  };
2016
2031
  };
2032
+ name: string;
2017
2033
  } | {
2018
2034
  srgb: {
2019
2035
  light: {
@@ -2140,6 +2156,7 @@ export declare const colors: ({
2140
2156
  dark: string;
2141
2157
  };
2142
2158
  };
2159
+ name: string;
2143
2160
  } | {
2144
2161
  srgb: {
2145
2162
  light: {
@@ -2266,6 +2283,7 @@ export declare const colors: ({
2266
2283
  dark: string;
2267
2284
  };
2268
2285
  };
2286
+ name: string;
2269
2287
  } | {
2270
2288
  srgb: {
2271
2289
  light: {
@@ -2392,6 +2410,7 @@ export declare const colors: ({
2392
2410
  dark: string;
2393
2411
  };
2394
2412
  };
2413
+ name: string;
2395
2414
  } | {
2396
2415
  srgb: {
2397
2416
  light: {
@@ -2518,6 +2537,7 @@ export declare const colors: ({
2518
2537
  dark: string;
2519
2538
  };
2520
2539
  };
2540
+ name: string;
2521
2541
  } | {
2522
2542
  srgb: {
2523
2543
  light: {
@@ -2644,6 +2664,7 @@ export declare const colors: ({
2644
2664
  dark: string;
2645
2665
  };
2646
2666
  };
2667
+ name: string;
2647
2668
  } | {
2648
2669
  srgb: {
2649
2670
  light: {
@@ -2770,6 +2791,7 @@ export declare const colors: ({
2770
2791
  dark: string;
2771
2792
  };
2772
2793
  };
2794
+ name: string;
2773
2795
  } | {
2774
2796
  srgb: {
2775
2797
  light: {
@@ -2896,6 +2918,7 @@ export declare const colors: ({
2896
2918
  dark: string;
2897
2919
  };
2898
2920
  };
2921
+ name: string;
2899
2922
  } | {
2900
2923
  srgb: {
2901
2924
  light: {
@@ -3022,6 +3045,7 @@ export declare const colors: ({
3022
3045
  dark: string;
3023
3046
  };
3024
3047
  };
3048
+ name: string;
3025
3049
  } | {
3026
3050
  srgb: {
3027
3051
  light: {
@@ -3148,6 +3172,7 @@ export declare const colors: ({
3148
3172
  dark: string;
3149
3173
  };
3150
3174
  };
3175
+ name: string;
3151
3176
  } | {
3152
3177
  srgb: {
3153
3178
  light: {
@@ -3274,6 +3299,7 @@ export declare const colors: ({
3274
3299
  dark: string;
3275
3300
  };
3276
3301
  };
3302
+ name: string;
3277
3303
  } | {
3278
3304
  srgb: {
3279
3305
  light: {
@@ -3400,6 +3426,7 @@ export declare const colors: ({
3400
3426
  dark: string;
3401
3427
  };
3402
3428
  };
3429
+ name: string;
3403
3430
  } | {
3404
3431
  srgb: {
3405
3432
  light: {
@@ -3526,6 +3553,7 @@ export declare const colors: ({
3526
3553
  dark: string;
3527
3554
  };
3528
3555
  };
3556
+ name: string;
3529
3557
  } | {
3530
3558
  srgb: {
3531
3559
  light: {
@@ -3652,6 +3680,7 @@ export declare const colors: ({
3652
3680
  dark: string;
3653
3681
  };
3654
3682
  };
3683
+ name: string;
3655
3684
  } | {
3656
3685
  srgb: {
3657
3686
  light: {
@@ -3778,6 +3807,7 @@ export declare const colors: ({
3778
3807
  dark: string;
3779
3808
  };
3780
3809
  };
3810
+ name: string;
3781
3811
  } | {
3782
3812
  srgb: {
3783
3813
  light: {
@@ -3904,6 +3934,7 @@ export declare const colors: ({
3904
3934
  dark: string;
3905
3935
  };
3906
3936
  };
3937
+ name: string;
3907
3938
  })[];
3908
3939
  export default colors;
3909
3940
  export { accentColors, grayColors } from './types.ts';
package/dist/types.d.ts CHANGED
@@ -8,6 +8,7 @@ export type ColorScale<C extends Color> = {
8
8
  [K in `${C}${ScaleStep}` | `${C}A${ScaleStep}`]: string;
9
9
  };
10
10
  export type ColorPalette<C extends Color> = {
11
+ name: C;
11
12
  srgb: {
12
13
  light: ColorScale<C>;
13
14
  dark: ColorScale<C>;
@@ -34,6 +35,7 @@ export type AlphaScale<C extends 'white' | 'back'> = {
34
35
  [K in `${C}A${ScaleStep}`]: string;
35
36
  };
36
37
  export type AlphaConfig<C extends 'white' | 'back'> = {
38
+ name: C;
37
39
  srgb: AlphaScale<C>;
38
40
  p3: AlphaScale<C>;
39
41
  };
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@diskette/palette",
3
3
  "type": "module",
4
- "version": "0.9.2",
4
+ "version": "0.11.0",
5
+ "bin": {
6
+ "palette": "./dist/cli.js"
7
+ },
5
8
  "exports": {
6
9
  ".": {
7
10
  "types": "./dist/index.d.ts",
@@ -39,6 +42,9 @@
39
42
  "singleQuote": true
40
43
  },
41
44
  "license": "MIT",
45
+ "dependencies": {
46
+ "@clack/prompts": "1.0.0-alpha.7"
47
+ },
42
48
  "scripts": {
43
49
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
44
50
  "typecheck": "tsc",