@eluan/theme-generator 0.1.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.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/cli/generate.d.ts +2 -0
- package/dist/cli/generate.js +207 -0
- package/dist/color/convert.d.ts +4 -0
- package/dist/color/convert.js +28 -0
- package/dist/color/curves.d.ts +3 -0
- package/dist/color/curves.js +29 -0
- package/dist/color/neutral.d.ts +2 -0
- package/dist/color/neutral.js +7 -0
- package/dist/color/scale.d.ts +2 -0
- package/dist/color/scale.js +19 -0
- package/dist/color/systemHues.d.ts +3 -0
- package/dist/color/systemHues.js +28 -0
- package/dist/compile/css.d.ts +7 -0
- package/dist/compile/css.js +160 -0
- package/dist/generate.d.ts +3 -0
- package/dist/generate.js +114 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +12 -0
- package/dist/input/validate.d.ts +16 -0
- package/dist/input/validate.js +93 -0
- package/dist/preview/smoke.d.ts +2 -0
- package/dist/preview/smoke.js +83 -0
- package/dist/tokens/contrast.d.ts +6 -0
- package/dist/tokens/contrast.js +126 -0
- package/dist/tokens/primitives.d.ts +2 -0
- package/dist/tokens/primitives.js +27 -0
- package/dist/tokens/semanticMap.d.ts +2 -0
- package/dist/tokens/semanticMap.js +161 -0
- package/dist/types.d.ts +68 -0
- package/dist/types.js +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export function buildSemanticMap() {
|
|
2
|
+
return {
|
|
3
|
+
// ── Container ──────────────────────────────────────────────
|
|
4
|
+
'container-bg': { light: 'neutral.50', dark: 'neutral.800', role: 'bg' },
|
|
5
|
+
'container-bg-alt': { light: 'neutral.100', dark: 'neutral.900', role: 'bg' },
|
|
6
|
+
'container-bg-inverse': { light: 'neutral.800', dark: 'neutral.100', role: 'bg' },
|
|
7
|
+
'container-border': { light: 'neutral.200', dark: 'neutral.700', role: 'border' },
|
|
8
|
+
'container-border-alt': { light: 'neutral.300', dark: 'neutral.600', role: 'border' },
|
|
9
|
+
'container-border-inverse': { light: 'neutral.600', dark: 'neutral.200', role: 'border' },
|
|
10
|
+
'container-fg': { light: 'neutral.950', dark: 'neutral.50', role: 'fg', contrastAgainst: 'container-bg', minContrast: 4.5 },
|
|
11
|
+
'container-fg-alt': { light: 'neutral.800', dark: 'neutral.100', role: 'fg', contrastAgainst: 'container-bg', minContrast: 4.5 },
|
|
12
|
+
'container-fg-inverse': { light: 'neutral.50', dark: 'neutral.950', role: 'fg', contrastAgainst: 'container-bg-inverse', minContrast: 4.5 },
|
|
13
|
+
// ── Interactive ────────────────────────────────────────────
|
|
14
|
+
'interactive-bg': { light: 'neutral.50', dark: 'neutral.800', role: 'bg' },
|
|
15
|
+
'interactive-bg-alt': { light: 'neutral.100', dark: 'neutral.900', role: 'bg' },
|
|
16
|
+
'interactive-bg-alt2': { light: 'primary.50', dark: 'primary.950', role: 'bg' },
|
|
17
|
+
'interactive-bg-disabled': { light: 'neutral.200', dark: 'neutral.700', role: 'bg' },
|
|
18
|
+
'interactive-bg-hover': { light: 'neutral.200', dark: 'neutral.700', role: 'bg' },
|
|
19
|
+
'interactive-bg-active': { light: 'primary.800', dark: 'primary.300', role: 'bg' },
|
|
20
|
+
'interactive-bg-selected': { light: 'primary.800', dark: 'primary.300', role: 'bg' },
|
|
21
|
+
'interactive-bg-inverse': { light: 'neutral.950', dark: 'neutral.50', role: 'bg' },
|
|
22
|
+
'interactive-border': { light: 'neutral.200', dark: 'neutral.700', role: 'border' },
|
|
23
|
+
'interactive-border-alt': { light: 'neutral.300', dark: 'neutral.600', role: 'border' },
|
|
24
|
+
'interactive-border-disabled': { light: 'neutral.300', dark: 'neutral.600', role: 'border' },
|
|
25
|
+
'interactive-fg': { light: 'neutral.950', dark: 'neutral.50', role: 'fg', contrastAgainst: 'interactive-bg', minContrast: 4.5 },
|
|
26
|
+
'interactive-fg-alt': { light: 'neutral.600', dark: 'neutral.300', role: 'fg', contrastAgainst: 'interactive-bg', minContrast: 3.0 },
|
|
27
|
+
'interactive-fg-readonly': { light: 'neutral.800', dark: 'neutral.100', role: 'fg', contrastAgainst: 'interactive-bg', minContrast: 4.5 },
|
|
28
|
+
'interactive-fg-disabled': { light: 'neutral.400', dark: 'neutral.500', role: 'fg' },
|
|
29
|
+
'interactive-fg-active': { light: 'primary.100', dark: 'primary.900', role: 'fg', contrastAgainst: 'interactive-bg-active', minContrast: 4.5 },
|
|
30
|
+
'interactive-fg-selected': { light: 'primary.100', dark: 'primary.900', role: 'fg', contrastAgainst: 'interactive-bg-selected', minContrast: 4.5 },
|
|
31
|
+
'interactive-fg-inverse': { light: 'neutral.50', dark: 'neutral.950', role: 'fg', contrastAgainst: 'interactive-bg-inverse', minContrast: 4.5 },
|
|
32
|
+
// ── Action Primary ─────────────────────────────────────────
|
|
33
|
+
'action-primary-bg': { light: 'primary.500', dark: 'primary.500', role: 'bg' },
|
|
34
|
+
'action-primary-bg-hover': { light: 'primary.800', dark: 'primary.400', role: 'bg' },
|
|
35
|
+
'action-primary-bg-active': { light: 'primary.800', dark: 'primary.400', role: 'bg' },
|
|
36
|
+
'action-primary-bg-selected': { light: 'primary.800', dark: 'primary.400', role: 'bg' },
|
|
37
|
+
'action-primary-bg-disabled': { light: 'primary.100', dark: 'primary.900', role: 'bg' },
|
|
38
|
+
'action-primary-bg-inverse': { light: 'primary.50', dark: 'primary.950', role: 'bg' },
|
|
39
|
+
'action-primary-fg': { light: 'neutral.50', dark: 'neutral.50', role: 'fg', contrastAgainst: 'action-primary-bg', minContrast: 4.5 },
|
|
40
|
+
'action-primary-fg-disabled': { light: 'neutral.400', dark: 'neutral.600', role: 'fg' },
|
|
41
|
+
'action-primary-fg-active': { light: 'neutral.50', dark: 'neutral.50', role: 'fg', contrastAgainst: 'action-primary-bg-active', minContrast: 4.5 },
|
|
42
|
+
'action-primary-fg-selected': { light: 'neutral.50', dark: 'neutral.50', role: 'fg', contrastAgainst: 'action-primary-bg-selected', minContrast: 4.5 },
|
|
43
|
+
'action-primary-fg-inverse': { light: 'primary.700', dark: 'primary.200', role: 'fg', contrastAgainst: 'action-primary-bg-inverse', minContrast: 4.5 },
|
|
44
|
+
// ── Action Secondary ───────────────────────────────────────
|
|
45
|
+
'action-secondary-bg-hover': { light: 'primary.100', dark: 'primary.900', role: 'bg' },
|
|
46
|
+
'action-secondary-bg-active': { light: 'primary.500', dark: 'primary.500', role: 'bg' },
|
|
47
|
+
'action-secondary-bg-selected': { light: 'primary.500', dark: 'primary.500', role: 'bg' },
|
|
48
|
+
'action-secondary-bg-disabled': { light: 'neutral.200', dark: 'neutral.700', role: 'bg' },
|
|
49
|
+
'action-secondary-border': { light: 'primary.500', dark: 'primary.400', role: 'border' },
|
|
50
|
+
'action-secondary-border-alt': { light: 'primary.800', dark: 'primary.300', role: 'border' },
|
|
51
|
+
'action-secondary-border-disabled': { light: 'primary.100', dark: 'primary.900', role: 'border' },
|
|
52
|
+
'action-secondary-border-inverse': { light: 'primary.50', dark: 'primary.950', role: 'border' },
|
|
53
|
+
'action-secondary-fg': { light: 'primary.500', dark: 'primary.400', role: 'fg', contrastAgainst: 'container-bg', minContrast: 4.5 },
|
|
54
|
+
'action-secondary-fg-alt': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
55
|
+
'action-secondary-fg-disabled': { light: 'neutral.400', dark: 'neutral.500', role: 'fg' },
|
|
56
|
+
'action-secondary-fg-active': { light: 'neutral.50', dark: 'neutral.50', role: 'fg', contrastAgainst: 'action-secondary-bg-active', minContrast: 4.5 },
|
|
57
|
+
'action-secondary-fg-selected': { light: 'neutral.50', dark: 'neutral.50', role: 'fg', contrastAgainst: 'action-secondary-bg-selected', minContrast: 4.5 },
|
|
58
|
+
'action-secondary-fg-inverse': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
59
|
+
// ── Action Tertiary ────────────────────────────────────────
|
|
60
|
+
'action-tertiary-bg': { light: 'neutral.50', dark: 'neutral.800', role: 'bg' },
|
|
61
|
+
'action-tertiary-bg-alt': { light: 'neutral.100', dark: 'neutral.900', role: 'bg' },
|
|
62
|
+
'action-tertiary-bg-hover': { light: 'primary.50', dark: 'primary.950', role: 'bg' },
|
|
63
|
+
'action-tertiary-bg-active': { light: 'primary.100', dark: 'primary.900', role: 'bg' },
|
|
64
|
+
'action-tertiary-bg-selected': { light: 'primary.100', dark: 'primary.900', role: 'bg' },
|
|
65
|
+
'action-tertiary-bg-disabled': { light: 'neutral.50', dark: 'neutral.800', role: 'bg' },
|
|
66
|
+
'action-tertiary-bg-inverse': { light: 'neutral.50', dark: 'neutral.800', role: 'bg' },
|
|
67
|
+
'action-tertiary-border': { light: 'primary.500', dark: 'primary.400', role: 'border' },
|
|
68
|
+
'action-tertiary-border-alt': { light: 'primary.800', dark: 'primary.300', role: 'border' },
|
|
69
|
+
'action-tertiary-border-disabled': { light: 'neutral.300', dark: 'neutral.600', role: 'border' },
|
|
70
|
+
'action-tertiary-border-inverse': { light: 'primary.100', dark: 'primary.900', role: 'border' },
|
|
71
|
+
'action-tertiary-fg': { light: 'primary.500', dark: 'primary.400', role: 'fg', contrastAgainst: 'action-tertiary-bg', minContrast: 4.5 },
|
|
72
|
+
'action-tertiary-fg-alt': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
73
|
+
'action-tertiary-fg-disabled': { light: 'neutral.400', dark: 'neutral.500', role: 'fg' },
|
|
74
|
+
'action-tertiary-fg-active': { light: 'primary.700', dark: 'primary.200', role: 'fg', contrastAgainst: 'action-tertiary-bg-active', minContrast: 4.5 },
|
|
75
|
+
'action-tertiary-fg-selected': { light: 'primary.700', dark: 'primary.200', role: 'fg', contrastAgainst: 'action-tertiary-bg-selected', minContrast: 4.5 },
|
|
76
|
+
'action-tertiary-fg-inverse': { light: 'neutral.50', dark: 'neutral.950', role: 'fg' },
|
|
77
|
+
// ── Destructive ────────────────────────────────────────────
|
|
78
|
+
'destructive-bg': { light: 'error.50', dark: 'error.950', role: 'bg' },
|
|
79
|
+
'destructive-bg-alt': { light: 'error.100', dark: 'error.900', role: 'bg' },
|
|
80
|
+
'destructive-bg-hover': { light: 'error.100', dark: 'error.900', role: 'bg' },
|
|
81
|
+
'destructive-bg-active': { light: 'error.800', dark: 'error.300', role: 'bg' },
|
|
82
|
+
'destructive-bg-selected': { light: 'error.800', dark: 'error.300', role: 'bg' },
|
|
83
|
+
'destructive-bg-disabled': { light: 'neutral.200', dark: 'neutral.700', role: 'bg' },
|
|
84
|
+
'destructive-bg-inverse': { light: 'error.800', dark: 'error.200', role: 'bg' },
|
|
85
|
+
'destructive-border': { light: 'error.500', dark: 'error.400', role: 'border' },
|
|
86
|
+
'destructive-border-alt': { light: 'error.800', dark: 'error.300', role: 'border' },
|
|
87
|
+
'destructive-border-disabled': { light: 'error.100', dark: 'error.900', role: 'border' },
|
|
88
|
+
'destructive-border-inverse': { light: 'error.50', dark: 'error.950', role: 'border' },
|
|
89
|
+
'destructive-fg': { light: 'error.700', dark: 'error.200', role: 'fg', contrastAgainst: 'destructive-bg', minContrast: 4.5 },
|
|
90
|
+
'destructive-fg-alt': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
91
|
+
'destructive-fg-disabled': { light: 'neutral.400', dark: 'neutral.500', role: 'fg' },
|
|
92
|
+
'destructive-fg-active': { light: 'neutral.50', dark: 'neutral.950', role: 'fg', contrastAgainst: 'destructive-bg-active', minContrast: 4.5 },
|
|
93
|
+
'destructive-fg-selected': { light: 'neutral.50', dark: 'neutral.950', role: 'fg', contrastAgainst: 'destructive-bg-selected', minContrast: 4.5 },
|
|
94
|
+
'destructive-fg-inverse': { light: 'error.50', dark: 'error.950', role: 'fg', contrastAgainst: 'destructive-bg-inverse', minContrast: 4.5 },
|
|
95
|
+
// ── Positive ───────────────────────────────────────────────
|
|
96
|
+
'positive-bg': { light: 'success.50', dark: 'success.950', role: 'bg' },
|
|
97
|
+
'positive-bg-alt': { light: 'success.100', dark: 'success.900', role: 'bg' },
|
|
98
|
+
'positive-bg-inverse': { light: 'success.800', dark: 'success.200', role: 'bg' },
|
|
99
|
+
'positive-border': { light: 'success.500', dark: 'success.400', role: 'border' },
|
|
100
|
+
'positive-border-alt': { light: 'success.800', dark: 'success.300', role: 'border' },
|
|
101
|
+
'positive-border-inverse': { light: 'success.50', dark: 'success.950', role: 'border' },
|
|
102
|
+
'positive-fg': { light: 'success.700', dark: 'success.200', role: 'fg', contrastAgainst: 'positive-bg', minContrast: 4.5 },
|
|
103
|
+
'positive-fg-alt': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
104
|
+
'positive-fg-inverse': { light: 'success.50', dark: 'success.950', role: 'fg', contrastAgainst: 'positive-bg-inverse', minContrast: 4.5 },
|
|
105
|
+
// ── Cautionary ─────────────────────────────────────────────
|
|
106
|
+
'cautionary-bg': { light: 'warning.50', dark: 'warning.950', role: 'bg' },
|
|
107
|
+
'cautionary-bg-alt': { light: 'warning.100', dark: 'warning.900', role: 'bg' },
|
|
108
|
+
'cautionary-bg-inverse': { light: 'warning.800', dark: 'warning.200', role: 'bg' },
|
|
109
|
+
'cautionary-border': { light: 'warning.500', dark: 'warning.400', role: 'border' },
|
|
110
|
+
'cautionary-border-alt': { light: 'warning.800', dark: 'warning.300', role: 'border' },
|
|
111
|
+
'cautionary-border-inverse': { light: 'warning.50', dark: 'warning.950', role: 'border' },
|
|
112
|
+
'cautionary-fg': { light: 'warning.700', dark: 'warning.200', role: 'fg', contrastAgainst: 'cautionary-bg', minContrast: 4.5 },
|
|
113
|
+
'cautionary-fg-alt': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
114
|
+
'cautionary-fg-inverse': { light: 'warning.50', dark: 'warning.950', role: 'fg', contrastAgainst: 'cautionary-bg-inverse', minContrast: 4.5 },
|
|
115
|
+
// ── Informative ────────────────────────────────────────────
|
|
116
|
+
'informative-bg': { light: 'info.50', dark: 'info.950', role: 'bg' },
|
|
117
|
+
'informative-bg-alt': { light: 'info.100', dark: 'info.900', role: 'bg' },
|
|
118
|
+
'informative-bg-inverse': { light: 'info.800', dark: 'info.200', role: 'bg' },
|
|
119
|
+
'informative-border': { light: 'info.500', dark: 'info.400', role: 'border' },
|
|
120
|
+
'informative-border-alt': { light: 'info.800', dark: 'info.300', role: 'border' },
|
|
121
|
+
'informative-border-inverse': { light: 'info.50', dark: 'info.950', role: 'border' },
|
|
122
|
+
'informative-fg': { light: 'info.700', dark: 'info.200', role: 'fg', contrastAgainst: 'informative-bg', minContrast: 4.5 },
|
|
123
|
+
'informative-fg-alt': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
124
|
+
'informative-fg-inverse': { light: 'info.50', dark: 'info.950', role: 'fg', contrastAgainst: 'informative-bg-inverse', minContrast: 4.5 },
|
|
125
|
+
// ── Important ──────────────────────────────────────────────
|
|
126
|
+
'important-bg': { light: 'primary.50', dark: 'primary.950', role: 'bg' },
|
|
127
|
+
'important-bg-alt': { light: 'primary.100', dark: 'primary.900', role: 'bg' },
|
|
128
|
+
'important-bg-inverse': { light: 'primary.800', dark: 'primary.200', role: 'bg' },
|
|
129
|
+
'important-border': { light: 'primary.500', dark: 'primary.400', role: 'border' },
|
|
130
|
+
'important-border-alt': { light: 'primary.800', dark: 'primary.300', role: 'border' },
|
|
131
|
+
'important-border-inverse': { light: 'primary.50', dark: 'primary.950', role: 'border' },
|
|
132
|
+
'important-fg': { light: 'primary.700', dark: 'primary.200', role: 'fg', contrastAgainst: 'important-bg', minContrast: 4.5 },
|
|
133
|
+
'important-fg-alt': { light: 'neutral.950', dark: 'neutral.50', role: 'fg' },
|
|
134
|
+
'important-fg-inverse': { light: 'primary.50', dark: 'primary.950', role: 'fg', contrastAgainst: 'important-bg-inverse', minContrast: 4.5 },
|
|
135
|
+
// ── Dataviz ────────────────────────────────────────────────
|
|
136
|
+
'dataviz-1-main': { light: 'primary.500', dark: 'primary.400', role: 'decorative' },
|
|
137
|
+
'dataviz-1-tint': { light: 'primary.100', dark: 'primary.900', role: 'decorative' },
|
|
138
|
+
'dataviz-1-shade': { light: 'primary.800', dark: 'primary.200', role: 'decorative' },
|
|
139
|
+
'dataviz-2-main': { light: 'info.500', dark: 'info.400', role: 'decorative' },
|
|
140
|
+
'dataviz-2-tint': { light: 'info.100', dark: 'info.900', role: 'decorative' },
|
|
141
|
+
'dataviz-2-shade': { light: 'info.800', dark: 'info.200', role: 'decorative' },
|
|
142
|
+
'dataviz-3-main': { light: 'success.500', dark: 'success.400', role: 'decorative' },
|
|
143
|
+
'dataviz-3-tint': { light: 'success.100', dark: 'success.900', role: 'decorative' },
|
|
144
|
+
'dataviz-3-shade': { light: 'success.800', dark: 'success.200', role: 'decorative' },
|
|
145
|
+
'dataviz-4-main': { light: 'primary.600', dark: 'primary.300', role: 'decorative' },
|
|
146
|
+
'dataviz-4-tint': { light: 'primary.200', dark: 'primary.800', role: 'decorative' },
|
|
147
|
+
'dataviz-4-shade': { light: 'primary.900', dark: 'primary.100', role: 'decorative' },
|
|
148
|
+
'dataviz-5-main': { light: 'warning.500', dark: 'warning.400', role: 'decorative' },
|
|
149
|
+
'dataviz-5-tint': { light: 'warning.100', dark: 'warning.900', role: 'decorative' },
|
|
150
|
+
'dataviz-5-shade': { light: 'warning.800', dark: 'warning.200', role: 'decorative' },
|
|
151
|
+
'dataviz-6-main': { light: 'error.500', dark: 'error.400', role: 'decorative' },
|
|
152
|
+
'dataviz-6-tint': { light: 'error.100', dark: 'error.900', role: 'decorative' },
|
|
153
|
+
'dataviz-6-shade': { light: 'error.800', dark: 'error.200', role: 'decorative' },
|
|
154
|
+
'dataviz-7-main': { light: 'success.600', dark: 'success.300', role: 'decorative' },
|
|
155
|
+
'dataviz-7-tint': { light: 'success.200', dark: 'success.800', role: 'decorative' },
|
|
156
|
+
'dataviz-7-shade': { light: 'success.900', dark: 'success.100', role: 'decorative' },
|
|
157
|
+
'dataviz-8-main': { light: 'info.600', dark: 'info.300', role: 'decorative' },
|
|
158
|
+
'dataviz-8-tint': { light: 'info.200', dark: 'info.800', role: 'decorative' },
|
|
159
|
+
'dataviz-8-shade': { light: 'info.900', dark: 'info.100', role: 'decorative' },
|
|
160
|
+
};
|
|
161
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type Oklch = {
|
|
2
|
+
mode: 'oklch';
|
|
3
|
+
l: number;
|
|
4
|
+
c: number;
|
|
5
|
+
h: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const SCALE_STEPS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
8
|
+
export type ScaleStepValue = (typeof SCALE_STEPS)[number];
|
|
9
|
+
export type ScaleStep = {
|
|
10
|
+
step: ScaleStepValue;
|
|
11
|
+
lightness: number;
|
|
12
|
+
chromaRatio: number;
|
|
13
|
+
hueShift: number;
|
|
14
|
+
};
|
|
15
|
+
export type ScaleEntry = {
|
|
16
|
+
oklch: Oklch;
|
|
17
|
+
hex: string;
|
|
18
|
+
};
|
|
19
|
+
export type Scale = Record<ScaleStepValue, ScaleEntry>;
|
|
20
|
+
export type ScaleName = 'primary' | 'secondary' | 'tertiary' | 'neutral' | 'success' | 'warning' | 'error' | 'info';
|
|
21
|
+
export type SystemHueName = 'error' | 'warning' | 'success' | 'info';
|
|
22
|
+
export type PrimitiveTokens = Partial<Record<ScaleName, Scale>>;
|
|
23
|
+
export type TokenRef = `${ScaleName}.${ScaleStepValue}` | 'white' | 'black';
|
|
24
|
+
export type SemanticRole = 'bg' | 'fg' | 'border' | 'overlay' | 'decorative';
|
|
25
|
+
export type SemanticEntry = {
|
|
26
|
+
light: TokenRef;
|
|
27
|
+
dark: TokenRef;
|
|
28
|
+
contrastAgainst?: string;
|
|
29
|
+
minContrast?: number;
|
|
30
|
+
role: SemanticRole;
|
|
31
|
+
};
|
|
32
|
+
export type SemanticMap = Record<string, SemanticEntry>;
|
|
33
|
+
export type GeneratorConfig = {
|
|
34
|
+
accents: string[];
|
|
35
|
+
themeName: string;
|
|
36
|
+
minContrast: number;
|
|
37
|
+
neutralTintRatio: number;
|
|
38
|
+
curve?: ScaleStep[];
|
|
39
|
+
systemHues?: Partial<Record<SystemHueName, number>>;
|
|
40
|
+
};
|
|
41
|
+
export type AccentClassification = 'normal' | 'low-chroma' | 'extreme-lightness';
|
|
42
|
+
export type ValidatedAccent = {
|
|
43
|
+
hex: string;
|
|
44
|
+
oklch: Oklch;
|
|
45
|
+
classification: AccentClassification;
|
|
46
|
+
};
|
|
47
|
+
export type ContrastCorrection = {
|
|
48
|
+
token: string;
|
|
49
|
+
mode: 'light' | 'dark';
|
|
50
|
+
originalRef: TokenRef;
|
|
51
|
+
correctedRef: TokenRef;
|
|
52
|
+
originalContrast: number;
|
|
53
|
+
correctedContrast: number;
|
|
54
|
+
kind: 'step-shift' | 'hard-fallback';
|
|
55
|
+
};
|
|
56
|
+
export type GeneratorResult = {
|
|
57
|
+
primitives: PrimitiveTokens;
|
|
58
|
+
semanticMap: SemanticMap;
|
|
59
|
+
corrections: ContrastCorrection[];
|
|
60
|
+
css: {
|
|
61
|
+
primitives: string;
|
|
62
|
+
lightMode: string;
|
|
63
|
+
darkMode: string;
|
|
64
|
+
theme: string;
|
|
65
|
+
};
|
|
66
|
+
createThemeTokens: Record<string, string>;
|
|
67
|
+
report: string;
|
|
68
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SCALE_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@eluan/theme-generator",
|
|
3
|
+
"description": "CLI tool that generates accessible, light + dark mode Eluan theme token sets from accent colors",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/vasfio/eluan#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/vasfio/eluan.git",
|
|
10
|
+
"directory": "packages/theme-generator"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/vasfio/eluan/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"design-tokens",
|
|
17
|
+
"theme",
|
|
18
|
+
"cli",
|
|
19
|
+
"eluan",
|
|
20
|
+
"color"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"bin": {
|
|
26
|
+
"eluan-theme": "./dist/cli/generate.js"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"culori": "^4.0.1",
|
|
42
|
+
"prompts": "^2.4.2"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/prompts": "^2.4.9",
|
|
46
|
+
"typescript": "^5.4.5",
|
|
47
|
+
"vitest": "^2.0.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
51
|
+
"dev": "tsc --watch",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest"
|
|
54
|
+
}
|
|
55
|
+
}
|