@diskette/palette 0.16.0 → 0.19.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/dist/cli/commands/generate.d.ts +0 -10
  2. package/dist/cli/commands/generate.js +22 -23
  3. package/dist/colors/amber.d.ts +12 -112
  4. package/dist/colors/amber.js +115 -114
  5. package/dist/colors/blue.d.ts +12 -112
  6. package/dist/colors/blue.js +115 -114
  7. package/dist/colors/bronze.d.ts +12 -112
  8. package/dist/colors/bronze.js +115 -114
  9. package/dist/colors/brown.d.ts +12 -112
  10. package/dist/colors/brown.js +115 -114
  11. package/dist/colors/crimson.d.ts +12 -112
  12. package/dist/colors/crimson.js +115 -114
  13. package/dist/colors/cyan.d.ts +12 -112
  14. package/dist/colors/cyan.js +115 -114
  15. package/dist/colors/gold.d.ts +12 -112
  16. package/dist/colors/gold.js +115 -114
  17. package/dist/colors/grass.d.ts +12 -112
  18. package/dist/colors/grass.js +115 -114
  19. package/dist/colors/gray.d.ts +12 -112
  20. package/dist/colors/gray.js +115 -114
  21. package/dist/colors/green.d.ts +12 -112
  22. package/dist/colors/green.js +115 -114
  23. package/dist/colors/indigo.d.ts +12 -112
  24. package/dist/colors/indigo.js +115 -114
  25. package/dist/colors/iris.d.ts +12 -112
  26. package/dist/colors/iris.js +115 -114
  27. package/dist/colors/jade.d.ts +12 -112
  28. package/dist/colors/jade.js +115 -114
  29. package/dist/colors/lime.d.ts +12 -112
  30. package/dist/colors/lime.js +115 -114
  31. package/dist/colors/mauve.d.ts +12 -112
  32. package/dist/colors/mauve.js +115 -114
  33. package/dist/colors/mint.d.ts +12 -112
  34. package/dist/colors/mint.js +115 -114
  35. package/dist/colors/olive.d.ts +12 -112
  36. package/dist/colors/olive.js +115 -114
  37. package/dist/colors/orange.d.ts +12 -112
  38. package/dist/colors/orange.js +115 -114
  39. package/dist/colors/pink.d.ts +12 -112
  40. package/dist/colors/pink.js +115 -114
  41. package/dist/colors/plum.d.ts +12 -112
  42. package/dist/colors/plum.js +115 -114
  43. package/dist/colors/purple.d.ts +12 -112
  44. package/dist/colors/purple.js +115 -114
  45. package/dist/colors/red.d.ts +12 -112
  46. package/dist/colors/red.js +115 -114
  47. package/dist/colors/ruby.d.ts +12 -112
  48. package/dist/colors/ruby.js +115 -114
  49. package/dist/colors/sage.d.ts +12 -112
  50. package/dist/colors/sage.js +115 -114
  51. package/dist/colors/sand.d.ts +12 -112
  52. package/dist/colors/sand.js +115 -114
  53. package/dist/colors/sky.d.ts +12 -112
  54. package/dist/colors/sky.js +115 -114
  55. package/dist/colors/slate.d.ts +12 -112
  56. package/dist/colors/slate.js +115 -114
  57. package/dist/colors/teal.d.ts +12 -112
  58. package/dist/colors/teal.js +115 -114
  59. package/dist/colors/tomato.d.ts +12 -112
  60. package/dist/colors/tomato.js +115 -114
  61. package/dist/colors/violet.d.ts +12 -112
  62. package/dist/colors/violet.js +115 -114
  63. package/dist/colors/yellow.d.ts +12 -112
  64. package/dist/colors/yellow.js +115 -114
  65. package/dist/css.d.ts +2 -2
  66. package/dist/css.js +6 -11
  67. package/dist/index.d.ts +622 -3690
  68. package/dist/index.js +3 -3
  69. package/dist/types.d.ts +9 -12
  70. package/dist/utils.d.ts +1 -0
  71. package/dist/utils.js +8 -0
  72. package/package.json +1 -3
@@ -1,125 +1,25 @@
1
1
  declare const _default: {
2
- srgb: {
3
- light: {
4
- yellow1: string;
5
- yellow2: string;
6
- yellow3: string;
7
- yellow4: string;
8
- yellow5: string;
9
- yellow6: string;
10
- yellow7: string;
11
- yellow8: string;
12
- yellow9: string;
13
- yellow10: string;
14
- yellow11: string;
15
- yellow12: string;
16
- yellowA1: string;
17
- yellowA2: string;
18
- yellowA3: string;
19
- yellowA4: string;
20
- yellowA5: string;
21
- yellowA6: string;
22
- yellowA7: string;
23
- yellowA8: string;
24
- yellowA9: string;
25
- yellowA10: string;
26
- yellowA11: string;
27
- yellowA12: string;
28
- };
29
- dark: {
30
- yellow1: string;
31
- yellow2: string;
32
- yellow3: string;
33
- yellow4: string;
34
- yellow5: string;
35
- yellow6: string;
36
- yellow7: string;
37
- yellow8: string;
38
- yellow9: string;
39
- yellow10: string;
40
- yellow11: string;
41
- yellow12: string;
42
- yellowA1: string;
43
- yellowA2: string;
44
- yellowA3: string;
45
- yellowA4: string;
46
- yellowA5: string;
47
- yellowA6: string;
48
- yellowA7: string;
49
- yellowA8: string;
50
- yellowA9: string;
51
- yellowA10: string;
52
- yellowA11: string;
53
- yellowA12: string;
54
- };
55
- };
56
- p3: {
57
- light: {
58
- yellow1: string;
59
- yellow2: string;
60
- yellow3: string;
61
- yellow4: string;
62
- yellow5: string;
63
- yellow6: string;
64
- yellow7: string;
65
- yellow8: string;
66
- yellow9: string;
67
- yellow10: string;
68
- yellow11: string;
69
- yellow12: string;
70
- yellowA1: string;
71
- yellowA2: string;
72
- yellowA3: string;
73
- yellowA4: string;
74
- yellowA5: string;
75
- yellowA6: string;
76
- yellowA7: string;
77
- yellowA8: string;
78
- yellowA9: string;
79
- yellowA10: string;
80
- yellowA11: string;
81
- yellowA12: string;
82
- };
83
- dark: {
84
- yellow1: string;
85
- yellow2: string;
86
- yellow3: string;
87
- yellow4: string;
88
- yellow5: string;
89
- yellow6: string;
90
- yellow7: string;
91
- yellow8: string;
92
- yellow9: string;
93
- yellow10: string;
94
- yellow11: string;
95
- yellow12: string;
96
- yellowA1: string;
97
- yellowA2: string;
98
- yellowA3: string;
99
- yellowA4: string;
100
- yellowA5: string;
101
- yellowA6: string;
102
- yellowA7: string;
103
- yellowA8: string;
104
- yellowA9: string;
105
- yellowA10: string;
106
- yellowA11: string;
107
- yellowA12: string;
108
- };
109
- };
110
- contrast: string;
2
+ name: "yellow";
111
3
  indicator: string;
4
+ contrast: string;
112
5
  track: string;
113
6
  surface: {
114
- srgb: {
7
+ p3: {
115
8
  light: string;
116
9
  dark: string;
117
10
  };
118
- p3: {
11
+ srgb: {
119
12
  light: string;
120
13
  dark: string;
121
14
  };
122
15
  };
123
- name: "yellow";
16
+ srgb: {
17
+ light: [string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string];
18
+ dark: [string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string];
19
+ };
20
+ p3: {
21
+ light: [string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string];
22
+ dark: [string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string];
23
+ };
124
24
  };
125
25
  export default _default;
@@ -1,124 +1,125 @@
1
+ import {} from "../types.js";
1
2
  export default {
2
- srgb: {
3
- light: {
4
- yellow1: '#fdfdf9',
5
- yellow2: '#fefce9',
6
- yellow3: '#fffab8',
7
- yellow4: '#fff394',
8
- yellow5: '#ffe770',
9
- yellow6: '#f3d768',
10
- yellow7: '#e4c767',
11
- yellow8: '#d5ae39',
12
- yellow9: '#ffe629',
13
- yellow10: '#ffdc00',
14
- yellow11: '#9e6c00',
15
- yellow12: '#473b1f',
16
- yellowA1: '#aaaa0006',
17
- yellowA2: '#f4dd0016',
18
- yellowA3: '#ffee0047',
19
- yellowA4: '#ffe3016b',
20
- yellowA5: '#ffd5008f',
21
- yellowA6: '#ebbc0097',
22
- yellowA7: '#d2a10098',
23
- yellowA8: '#c99700c6',
24
- yellowA9: '#ffe100d6',
25
- yellowA10: '#ffdc00',
26
- yellowA11: '#9e6c00',
27
- yellowA12: '#2e2000e0',
28
- },
29
- dark: {
30
- yellow1: '#14120b',
31
- yellow2: '#1b180f',
32
- yellow3: '#2d2305',
33
- yellow4: '#362b00',
34
- yellow5: '#433500',
35
- yellow6: '#524202',
36
- yellow7: '#665417',
37
- yellow8: '#836a21',
38
- yellow9: '#ffe629',
39
- yellow10: '#ffff57',
40
- yellow11: '#f5e147',
41
- yellow12: '#f6eeb4',
42
- yellowA1: '#d1510004',
43
- yellowA2: '#f9b4000b',
44
- yellowA3: '#ffaa001e',
45
- yellowA4: '#fdb70028',
46
- yellowA5: '#febb0036',
47
- yellowA6: '#fec40046',
48
- yellowA7: '#fdcb225c',
49
- yellowA8: '#fdca327b',
50
- yellowA9: '#ffe629',
51
- yellowA10: '#ffff57',
52
- yellowA11: '#fee949f5',
53
- yellowA12: '#fef6baf6',
54
- },
55
- },
56
- p3: {
57
- light: {
58
- yellow1: 'color(display-p3 0.992 0.992 0.978)',
59
- yellow2: 'color(display-p3 0.995 0.99 0.922)',
60
- yellow3: 'color(display-p3 0.997 0.982 0.749)',
61
- yellow4: 'color(display-p3 0.992 0.953 0.627)',
62
- yellow5: 'color(display-p3 0.984 0.91 0.51)',
63
- yellow6: 'color(display-p3 0.934 0.847 0.474)',
64
- yellow7: 'color(display-p3 0.876 0.785 0.46)',
65
- yellow8: 'color(display-p3 0.811 0.689 0.313)',
66
- yellow9: 'color(display-p3 1 0.92 0.22)',
67
- yellow10: 'color(display-p3 0.977 0.868 0.291)',
68
- yellow11: 'color(display-p3 0.6 0.44 0)',
69
- yellow12: 'color(display-p3 0.271 0.233 0.137)',
70
- yellowA1: 'color(display-p3 0.675 0.675 0.024 / 0.024)',
71
- yellowA2: 'color(display-p3 0.953 0.855 0.008 / 0.079)',
72
- yellowA3: 'color(display-p3 0.988 0.925 0.004 / 0.251)',
73
- yellowA4: 'color(display-p3 0.98 0.875 0.004 / 0.373)',
74
- yellowA5: 'color(display-p3 0.969 0.816 0.004 / 0.491)',
75
- yellowA6: 'color(display-p3 0.875 0.71 0 / 0.526)',
76
- yellowA7: 'color(display-p3 0.769 0.604 0 / 0.542)',
77
- yellowA8: 'color(display-p3 0.725 0.549 0 / 0.687)',
78
- yellowA9: 'color(display-p3 1 0.898 0 / 0.781)',
79
- yellowA10: 'color(display-p3 0.969 0.812 0 / 0.71)',
80
- yellowA11: 'color(display-p3 0.6 0.44 0)',
81
- yellowA12: 'color(display-p3 0.271 0.233 0.137)',
82
- },
83
- dark: {
84
- yellow1: 'color(display-p3 0.078 0.069 0.047)',
85
- yellow2: 'color(display-p3 0.103 0.094 0.063)',
86
- yellow3: 'color(display-p3 0.168 0.137 0.039)',
87
- yellow4: 'color(display-p3 0.209 0.169 0)',
88
- yellow5: 'color(display-p3 0.255 0.209 0)',
89
- yellow6: 'color(display-p3 0.31 0.261 0.07)',
90
- yellow7: 'color(display-p3 0.389 0.331 0.135)',
91
- yellow8: 'color(display-p3 0.497 0.42 0.182)',
92
- yellow9: 'color(display-p3 1 0.92 0.22)',
93
- yellow10: 'color(display-p3 1 1 0.456)',
94
- yellow11: 'color(display-p3 0.948 0.885 0.392)',
95
- yellow12: 'color(display-p3 0.959 0.934 0.731)',
96
- yellowA1: 'color(display-p3 0.973 0.369 0 / 0.013)',
97
- yellowA2: 'color(display-p3 0.996 0.792 0 / 0.038)',
98
- yellowA3: 'color(display-p3 0.996 0.71 0 / 0.11)',
99
- yellowA4: 'color(display-p3 0.996 0.741 0 / 0.152)',
100
- yellowA5: 'color(display-p3 0.996 0.765 0 / 0.202)',
101
- yellowA6: 'color(display-p3 0.996 0.816 0.082 / 0.261)',
102
- yellowA7: 'color(display-p3 1 0.831 0.263 / 0.345)',
103
- yellowA8: 'color(display-p3 1 0.831 0.314 / 0.463)',
104
- yellowA9: 'color(display-p3 1 0.922 0.22)',
105
- yellowA10: 'color(display-p3 1 1 0.455)',
106
- yellowA11: 'color(display-p3 0.948 0.885 0.392)',
107
- yellowA12: 'color(display-p3 0.959 0.934 0.731)',
108
- },
109
- },
110
- contrast: '#21201c',
3
+ name: 'yellow',
111
4
  indicator: 'yellow10',
5
+ contrast: '#21201c',
112
6
  track: 'yellow10',
113
7
  surface: {
114
- srgb: {
115
- light: '#fefbe4cc',
116
- dark: '#231f1380',
117
- },
118
8
  p3: {
119
9
  light: 'color(display-p3 0.9961 0.9922 0.902 / 0.8)',
120
10
  dark: 'color(display-p3 0.1333 0.1176 0.0706 / 0.5)',
121
11
  },
12
+ srgb: {
13
+ light: '#fefbe4cc',
14
+ dark: '#231f1380',
15
+ },
16
+ },
17
+ srgb: {
18
+ light: [
19
+ '#fdfdf9',
20
+ '#fefce9',
21
+ '#fffab8',
22
+ '#fff394',
23
+ '#ffe770',
24
+ '#f3d768',
25
+ '#e4c767',
26
+ '#d5ae39',
27
+ '#ffe629',
28
+ '#ffdc00',
29
+ '#9e6c00',
30
+ '#473b1f',
31
+ '#aaaa0006',
32
+ '#f4dd0016',
33
+ '#ffee0047',
34
+ '#ffe3016b',
35
+ '#ffd5008f',
36
+ '#ebbc0097',
37
+ '#d2a10098',
38
+ '#c99700c6',
39
+ '#ffe100d6',
40
+ '#ffdc00',
41
+ '#9e6c00',
42
+ '#2e2000e0',
43
+ ],
44
+ dark: [
45
+ '#14120b',
46
+ '#1b180f',
47
+ '#2d2305',
48
+ '#362b00',
49
+ '#433500',
50
+ '#524202',
51
+ '#665417',
52
+ '#836a21',
53
+ '#ffe629',
54
+ '#ffff57',
55
+ '#f5e147',
56
+ '#f6eeb4',
57
+ '#d1510004',
58
+ '#f9b4000b',
59
+ '#ffaa001e',
60
+ '#fdb70028',
61
+ '#febb0036',
62
+ '#fec40046',
63
+ '#fdcb225c',
64
+ '#fdca327b',
65
+ '#ffe629',
66
+ '#ffff57',
67
+ '#fee949f5',
68
+ '#fef6baf6',
69
+ ],
70
+ },
71
+ p3: {
72
+ light: [
73
+ 'color(display-p3 0.992 0.992 0.978)',
74
+ 'color(display-p3 0.995 0.99 0.922)',
75
+ 'color(display-p3 0.997 0.982 0.749)',
76
+ 'color(display-p3 0.992 0.953 0.627)',
77
+ 'color(display-p3 0.984 0.91 0.51)',
78
+ 'color(display-p3 0.934 0.847 0.474)',
79
+ 'color(display-p3 0.876 0.785 0.46)',
80
+ 'color(display-p3 0.811 0.689 0.313)',
81
+ 'color(display-p3 1 0.92 0.22)',
82
+ 'color(display-p3 0.977 0.868 0.291)',
83
+ 'color(display-p3 0.6 0.44 0)',
84
+ 'color(display-p3 0.271 0.233 0.137)',
85
+ 'color(display-p3 0.675 0.675 0.024 / 0.024)',
86
+ 'color(display-p3 0.953 0.855 0.008 / 0.079)',
87
+ 'color(display-p3 0.988 0.925 0.004 / 0.251)',
88
+ 'color(display-p3 0.98 0.875 0.004 / 0.373)',
89
+ 'color(display-p3 0.969 0.816 0.004 / 0.491)',
90
+ 'color(display-p3 0.875 0.71 0 / 0.526)',
91
+ 'color(display-p3 0.769 0.604 0 / 0.542)',
92
+ 'color(display-p3 0.725 0.549 0 / 0.687)',
93
+ 'color(display-p3 1 0.898 0 / 0.781)',
94
+ 'color(display-p3 0.969 0.812 0 / 0.71)',
95
+ 'color(display-p3 0.6 0.44 0)',
96
+ 'color(display-p3 0.271 0.233 0.137)',
97
+ ],
98
+ dark: [
99
+ 'color(display-p3 0.078 0.069 0.047)',
100
+ 'color(display-p3 0.103 0.094 0.063)',
101
+ 'color(display-p3 0.168 0.137 0.039)',
102
+ 'color(display-p3 0.209 0.169 0)',
103
+ 'color(display-p3 0.255 0.209 0)',
104
+ 'color(display-p3 0.31 0.261 0.07)',
105
+ 'color(display-p3 0.389 0.331 0.135)',
106
+ 'color(display-p3 0.497 0.42 0.182)',
107
+ 'color(display-p3 1 0.92 0.22)',
108
+ 'color(display-p3 1 1 0.456)',
109
+ 'color(display-p3 0.948 0.885 0.392)',
110
+ 'color(display-p3 0.959 0.934 0.731)',
111
+ 'color(display-p3 0.973 0.369 0 / 0.013)',
112
+ 'color(display-p3 0.996 0.792 0 / 0.038)',
113
+ 'color(display-p3 0.996 0.71 0 / 0.11)',
114
+ 'color(display-p3 0.996 0.741 0 / 0.152)',
115
+ 'color(display-p3 0.996 0.765 0 / 0.202)',
116
+ 'color(display-p3 0.996 0.816 0.082 / 0.261)',
117
+ 'color(display-p3 1 0.831 0.263 / 0.345)',
118
+ 'color(display-p3 1 0.831 0.314 / 0.463)',
119
+ 'color(display-p3 1 0.922 0.22)',
120
+ 'color(display-p3 1 1 0.455)',
121
+ 'color(display-p3 0.948 0.885 0.392)',
122
+ 'color(display-p3 0.959 0.934 0.731)',
123
+ ],
122
124
  },
123
- name: 'yellow',
124
125
  };
package/dist/css.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AnyColorScale } from './types.ts';
1
+ import type { Color, PaletteColor } from './types.ts';
2
2
  type AlphaConfig = {
3
3
  srgb: Record<string, string>;
4
4
  p3: Record<string, string>;
@@ -9,7 +9,7 @@ type PaletteOptions = {
9
9
  /** Include alpha scale variables (e.g., --amber-a1). Defaults to false */
10
10
  alpha?: boolean;
11
11
  };
12
- declare function palette(name: string, config: AnyColorScale, options?: PaletteOptions): string;
12
+ declare function palette<C extends Color>(config: PaletteColor<C>, options?: PaletteOptions): string;
13
13
  declare function alpha(config: AlphaConfig): string;
14
14
  declare function accents(colorNames: string[]): string;
15
15
  declare function grays(names: readonly string[], className: string): string;
package/dist/css.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { formatNestedBlock, formatP3, formatRule, schemeSelector, toVarName, } from "./utils.js";
2
2
  const steps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
3
- function palette(name, config, options = {}) {
3
+ function palette(config, options = {}) {
4
4
  const { schemes = ['light'], alpha = false } = options;
5
+ const name = config.name;
5
6
  const output = [];
6
7
  if (schemes.includes('light')) {
7
8
  output.push(formatRule(':root', [
@@ -15,24 +16,18 @@ function palette(name, config, options = {}) {
15
16
  const selector = schemeSelector(scheme);
16
17
  const srgbScale = isLight ? config.srgb.light : config.srgb.dark;
17
18
  const p3Scale = isLight ? config.p3.light : config.p3.dark;
18
- const srgbSurface = isLight
19
- ? config.surface.srgb.light
20
- : config.surface.srgb.dark;
21
- const p3Surface = isLight ? config.surface.p3.light : config.surface.p3.dark;
22
19
  const srgb = [];
23
20
  const p3 = [];
24
21
  for (const n of steps) {
25
- srgb.push(`--${name}-${n}: ${srgbScale[`${name}${n}`]}`);
26
- p3.push(`--${name}-${n}: ${p3Scale[`${name}${n}`]}`);
22
+ srgb.push(`--${name}-${n}: ${srgbScale[n - 1]}`);
23
+ p3.push(`--${name}-${n}: ${p3Scale[n - 1]}`);
27
24
  }
28
25
  if (alpha) {
29
26
  for (const n of steps) {
30
- srgb.push(`--${name}-a${n}: ${srgbScale[`${name}A${n}`]}`);
31
- p3.push(`--${name}-a${n}: ${p3Scale[`${name}A${n}`]}`);
27
+ srgb.push(`--${name}-a${n}: ${srgbScale[n + 11]}`);
28
+ p3.push(`--${name}-a${n}: ${p3Scale[n + 11]}`);
32
29
  }
33
30
  }
34
- srgb.push(`--${name}-surface: ${srgbSurface}`);
35
- p3.push(`--${name}-surface: ${p3Surface}`);
36
31
  output.push(formatRule(selector, srgb));
37
32
  output.push(formatP3(selector, p3));
38
33
  }