@nice2dev/design-tokens 1.0.28
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/README.md +221 -0
- package/dist/chunk-GJ4A7ZWW.js +1242 -0
- package/dist/chunk-MCKGQKYU.js +15 -0
- package/dist/cli/index.cjs +3018 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +363 -0
- package/dist/esm-YLJOW3XL.js +1703 -0
- package/dist/index.cjs +3880 -0
- package/dist/index.d.cts +856 -0
- package/dist/index.d.ts +856 -0
- package/dist/index.js +2628 -0
- package/package.json +59 -0
- package/tokens/animation.json +147 -0
- package/tokens/colors.json +184 -0
- package/tokens/components.json +201 -0
- package/tokens/effects.json +206 -0
- package/tokens/spacing.json +105 -0
- package/tokens/themes.json +193 -0
- package/tokens/typography.json +219 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2628 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TokenGenerator,
|
|
3
|
+
buildTokenObject,
|
|
4
|
+
checkCircularReferences,
|
|
5
|
+
createGenerator,
|
|
6
|
+
createTheme,
|
|
7
|
+
createTokenCollection,
|
|
8
|
+
cubicBezierToCss,
|
|
9
|
+
darkenColor,
|
|
10
|
+
defaultOptions,
|
|
11
|
+
defaultThemes,
|
|
12
|
+
durationToMs,
|
|
13
|
+
extractReferencePath,
|
|
14
|
+
filterTokensByPath,
|
|
15
|
+
filterTokensByType,
|
|
16
|
+
findReferences,
|
|
17
|
+
flattenTokens,
|
|
18
|
+
fontWeightToNumber,
|
|
19
|
+
generateColorScale,
|
|
20
|
+
generateDarkModeTokens,
|
|
21
|
+
generateHighContrastTokens,
|
|
22
|
+
generateReactThemeContext,
|
|
23
|
+
generateThemeSwitcher,
|
|
24
|
+
generateThemesCss,
|
|
25
|
+
generateTokenTypes,
|
|
26
|
+
generateTokens,
|
|
27
|
+
getAccessibleTextColor,
|
|
28
|
+
getCategories,
|
|
29
|
+
getContrastRatio,
|
|
30
|
+
getDependencyGraph,
|
|
31
|
+
getTokenByPath,
|
|
32
|
+
hexToHsl,
|
|
33
|
+
hexToOklch,
|
|
34
|
+
hexToRgb,
|
|
35
|
+
isDesignToken,
|
|
36
|
+
isReference,
|
|
37
|
+
isTokenGroup,
|
|
38
|
+
lightenColor,
|
|
39
|
+
mergeTokenFiles,
|
|
40
|
+
parseTokenDirectory,
|
|
41
|
+
parseTokenFile,
|
|
42
|
+
parseTokenFiles,
|
|
43
|
+
pathToCssVariable,
|
|
44
|
+
pathToString,
|
|
45
|
+
pxToEm,
|
|
46
|
+
pxToRem,
|
|
47
|
+
remToPx,
|
|
48
|
+
resolveToVariable,
|
|
49
|
+
resolveTokenValue,
|
|
50
|
+
resolveTokens,
|
|
51
|
+
sortTokensByDependencies,
|
|
52
|
+
transformToCss,
|
|
53
|
+
transformToJs,
|
|
54
|
+
transformToScss,
|
|
55
|
+
transformToTailwind,
|
|
56
|
+
transformToTs
|
|
57
|
+
} from "./chunk-GJ4A7ZWW.js";
|
|
58
|
+
import "./chunk-MCKGQKYU.js";
|
|
59
|
+
|
|
60
|
+
// src/presets.ts
|
|
61
|
+
function generateColorScale2(baseColor) {
|
|
62
|
+
return {
|
|
63
|
+
50: lighten(baseColor, 0.95),
|
|
64
|
+
100: lighten(baseColor, 0.9),
|
|
65
|
+
200: lighten(baseColor, 0.75),
|
|
66
|
+
300: lighten(baseColor, 0.6),
|
|
67
|
+
400: lighten(baseColor, 0.3),
|
|
68
|
+
500: baseColor,
|
|
69
|
+
600: darken(baseColor, 0.1),
|
|
70
|
+
700: darken(baseColor, 0.25),
|
|
71
|
+
800: darken(baseColor, 0.4),
|
|
72
|
+
900: darken(baseColor, 0.55),
|
|
73
|
+
950: darken(baseColor, 0.7)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function hexToHsl2(hex) {
|
|
77
|
+
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
78
|
+
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
79
|
+
const b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
80
|
+
const max = Math.max(r, g, b);
|
|
81
|
+
const min = Math.min(r, g, b);
|
|
82
|
+
let h = 0;
|
|
83
|
+
let s = 0;
|
|
84
|
+
const l = (max + min) / 2;
|
|
85
|
+
if (max !== min) {
|
|
86
|
+
const d = max - min;
|
|
87
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
88
|
+
switch (max) {
|
|
89
|
+
case r:
|
|
90
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
91
|
+
break;
|
|
92
|
+
case g:
|
|
93
|
+
h = ((b - r) / d + 2) / 6;
|
|
94
|
+
break;
|
|
95
|
+
case b:
|
|
96
|
+
h = ((r - g) / d + 4) / 6;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return [h * 360, s * 100, l * 100];
|
|
101
|
+
}
|
|
102
|
+
function hslToHex(h, s, l) {
|
|
103
|
+
h /= 360;
|
|
104
|
+
s /= 100;
|
|
105
|
+
l /= 100;
|
|
106
|
+
const hue2rgb = (p, q, t) => {
|
|
107
|
+
if (t < 0) {
|
|
108
|
+
t += 1;
|
|
109
|
+
}
|
|
110
|
+
if (t > 1) {
|
|
111
|
+
t -= 1;
|
|
112
|
+
}
|
|
113
|
+
if (t < 1 / 6) {
|
|
114
|
+
return p + (q - p) * 6 * t;
|
|
115
|
+
}
|
|
116
|
+
if (t < 1 / 2) {
|
|
117
|
+
return q;
|
|
118
|
+
}
|
|
119
|
+
if (t < 2 / 3) {
|
|
120
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
121
|
+
}
|
|
122
|
+
return p;
|
|
123
|
+
};
|
|
124
|
+
let r, g, b;
|
|
125
|
+
if (s === 0) {
|
|
126
|
+
r = g = b = l;
|
|
127
|
+
} else {
|
|
128
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
129
|
+
const p = 2 * l - q;
|
|
130
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
131
|
+
g = hue2rgb(p, q, h);
|
|
132
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
133
|
+
}
|
|
134
|
+
const toHex = (n) => Math.round(n * 255).toString(16).padStart(2, "0");
|
|
135
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
136
|
+
}
|
|
137
|
+
function lighten(hex, amount) {
|
|
138
|
+
const [h, s, l] = hexToHsl2(hex);
|
|
139
|
+
return hslToHex(h, s, Math.min(100, l + (100 - l) * amount));
|
|
140
|
+
}
|
|
141
|
+
function darken(hex, amount) {
|
|
142
|
+
const [h, s, l] = hexToHsl2(hex);
|
|
143
|
+
return hslToHex(h, s, Math.max(0, l * (1 - amount)));
|
|
144
|
+
}
|
|
145
|
+
var GRAY_NEUTRAL = {
|
|
146
|
+
50: "#f9fafb",
|
|
147
|
+
100: "#f3f4f6",
|
|
148
|
+
200: "#e5e7eb",
|
|
149
|
+
300: "#d1d5db",
|
|
150
|
+
400: "#9ca3af",
|
|
151
|
+
500: "#6b7280",
|
|
152
|
+
600: "#4b5563",
|
|
153
|
+
700: "#374151",
|
|
154
|
+
800: "#1f2937",
|
|
155
|
+
900: "#111827",
|
|
156
|
+
950: "#030712"
|
|
157
|
+
};
|
|
158
|
+
var SLATE_NEUTRAL = {
|
|
159
|
+
50: "#f8fafc",
|
|
160
|
+
100: "#f1f5f9",
|
|
161
|
+
200: "#e2e8f0",
|
|
162
|
+
300: "#cbd5e1",
|
|
163
|
+
400: "#94a3b8",
|
|
164
|
+
500: "#64748b",
|
|
165
|
+
600: "#475569",
|
|
166
|
+
700: "#334155",
|
|
167
|
+
800: "#1e293b",
|
|
168
|
+
900: "#0f172a",
|
|
169
|
+
950: "#020617"
|
|
170
|
+
};
|
|
171
|
+
var ZINC_NEUTRAL = {
|
|
172
|
+
50: "#fafafa",
|
|
173
|
+
100: "#f4f4f5",
|
|
174
|
+
200: "#e4e4e7",
|
|
175
|
+
300: "#d4d4d8",
|
|
176
|
+
400: "#a1a1aa",
|
|
177
|
+
500: "#71717a",
|
|
178
|
+
600: "#52525b",
|
|
179
|
+
700: "#3f3f46",
|
|
180
|
+
800: "#27272a",
|
|
181
|
+
900: "#18181b",
|
|
182
|
+
950: "#09090b"
|
|
183
|
+
};
|
|
184
|
+
var WARM_NEUTRAL = {
|
|
185
|
+
50: "#faf5f0",
|
|
186
|
+
100: "#f0e8dd",
|
|
187
|
+
200: "#e0d0bb",
|
|
188
|
+
300: "#cdb899",
|
|
189
|
+
400: "#b89d77",
|
|
190
|
+
500: "#9a7f5a",
|
|
191
|
+
600: "#7d6548",
|
|
192
|
+
700: "#604c37",
|
|
193
|
+
800: "#443527",
|
|
194
|
+
900: "#2a1f18",
|
|
195
|
+
950: "#150f0c"
|
|
196
|
+
};
|
|
197
|
+
var PRESETS = [
|
|
198
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
199
|
+
// BRAND COLORS
|
|
200
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
201
|
+
{
|
|
202
|
+
name: "ocean-blue",
|
|
203
|
+
displayName: "Ocean Blue",
|
|
204
|
+
description: "Deep blue tones inspired by the ocean",
|
|
205
|
+
category: "brand",
|
|
206
|
+
colors: {
|
|
207
|
+
primary: generateColorScale2("#0077b6"),
|
|
208
|
+
secondary: generateColorScale2("#00b4d8"),
|
|
209
|
+
neutral: SLATE_NEUTRAL,
|
|
210
|
+
success: "#22c55e",
|
|
211
|
+
warning: "#f59e0b",
|
|
212
|
+
error: "#ef4444",
|
|
213
|
+
info: "#3b82f6"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "forest-green",
|
|
218
|
+
displayName: "Forest Green",
|
|
219
|
+
description: "Natural green tones inspired by forests",
|
|
220
|
+
category: "brand",
|
|
221
|
+
colors: {
|
|
222
|
+
primary: generateColorScale2("#15803d"),
|
|
223
|
+
secondary: generateColorScale2("#84cc16"),
|
|
224
|
+
neutral: GRAY_NEUTRAL,
|
|
225
|
+
success: "#22c55e",
|
|
226
|
+
warning: "#f59e0b",
|
|
227
|
+
error: "#ef4444",
|
|
228
|
+
info: "#3b82f6"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "sunset-orange",
|
|
233
|
+
displayName: "Sunset Orange",
|
|
234
|
+
description: "Warm orange and coral tones",
|
|
235
|
+
category: "brand",
|
|
236
|
+
colors: {
|
|
237
|
+
primary: generateColorScale2("#ea580c"),
|
|
238
|
+
secondary: generateColorScale2("#facc15"),
|
|
239
|
+
neutral: WARM_NEUTRAL,
|
|
240
|
+
success: "#22c55e",
|
|
241
|
+
warning: "#f59e0b",
|
|
242
|
+
error: "#dc2626",
|
|
243
|
+
info: "#0ea5e9"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: "royal-purple",
|
|
248
|
+
displayName: "Royal Purple",
|
|
249
|
+
description: "Elegant purple and violet tones",
|
|
250
|
+
category: "brand",
|
|
251
|
+
colors: {
|
|
252
|
+
primary: generateColorScale2("#7c3aed"),
|
|
253
|
+
secondary: generateColorScale2("#c026d3"),
|
|
254
|
+
neutral: SLATE_NEUTRAL,
|
|
255
|
+
success: "#22c55e",
|
|
256
|
+
warning: "#f59e0b",
|
|
257
|
+
error: "#ef4444",
|
|
258
|
+
info: "#3b82f6"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: "cherry-red",
|
|
263
|
+
displayName: "Cherry Red",
|
|
264
|
+
description: "Bold red with dark accents",
|
|
265
|
+
category: "bold",
|
|
266
|
+
colors: {
|
|
267
|
+
primary: generateColorScale2("#dc2626"),
|
|
268
|
+
secondary: generateColorScale2("#1f2937"),
|
|
269
|
+
neutral: ZINC_NEUTRAL,
|
|
270
|
+
success: "#22c55e",
|
|
271
|
+
warning: "#f59e0b",
|
|
272
|
+
error: "#b91c1c",
|
|
273
|
+
info: "#3b82f6"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "rose-gold",
|
|
278
|
+
displayName: "Rose Gold",
|
|
279
|
+
description: "Elegant rose and gold combination",
|
|
280
|
+
category: "brand",
|
|
281
|
+
colors: {
|
|
282
|
+
primary: generateColorScale2("#f43f5e"),
|
|
283
|
+
secondary: generateColorScale2("#d4a574"),
|
|
284
|
+
neutral: WARM_NEUTRAL,
|
|
285
|
+
success: "#22c55e",
|
|
286
|
+
warning: "#f59e0b",
|
|
287
|
+
error: "#e11d48",
|
|
288
|
+
info: "#3b82f6"
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "midnight",
|
|
293
|
+
displayName: "Midnight",
|
|
294
|
+
description: "Dark blue with cyan accents",
|
|
295
|
+
category: "professional",
|
|
296
|
+
colors: {
|
|
297
|
+
primary: generateColorScale2("#1e3a5f"),
|
|
298
|
+
secondary: generateColorScale2("#06b6d4"),
|
|
299
|
+
neutral: SLATE_NEUTRAL,
|
|
300
|
+
success: "#22c55e",
|
|
301
|
+
warning: "#f59e0b",
|
|
302
|
+
error: "#ef4444",
|
|
303
|
+
info: "#0ea5e9"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: "teal-modern",
|
|
308
|
+
displayName: "Teal Modern",
|
|
309
|
+
description: "Modern teal with warm accents",
|
|
310
|
+
category: "technology",
|
|
311
|
+
colors: {
|
|
312
|
+
primary: generateColorScale2("#0d9488"),
|
|
313
|
+
secondary: generateColorScale2("#f97316"),
|
|
314
|
+
neutral: GRAY_NEUTRAL,
|
|
315
|
+
success: "#22c55e",
|
|
316
|
+
warning: "#f59e0b",
|
|
317
|
+
error: "#ef4444",
|
|
318
|
+
info: "#14b8a6"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
322
|
+
// HEALTHCARE
|
|
323
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
324
|
+
{
|
|
325
|
+
name: "healthcare-trust",
|
|
326
|
+
displayName: "Healthcare Trust",
|
|
327
|
+
description: "Trustworthy blue for medical applications",
|
|
328
|
+
category: "healthcare",
|
|
329
|
+
colors: {
|
|
330
|
+
primary: generateColorScale2("#0077b6"),
|
|
331
|
+
secondary: generateColorScale2("#48cae4"),
|
|
332
|
+
neutral: SLATE_NEUTRAL,
|
|
333
|
+
success: "#22c55e",
|
|
334
|
+
warning: "#f59e0b",
|
|
335
|
+
error: "#ef4444",
|
|
336
|
+
info: "#3b82f6"
|
|
337
|
+
},
|
|
338
|
+
typography: {
|
|
339
|
+
fontFamily: "Inter, system-ui, sans-serif"
|
|
340
|
+
},
|
|
341
|
+
borderRadius: "md"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: "healthcare-calm",
|
|
345
|
+
displayName: "Healthcare Calm",
|
|
346
|
+
description: "Soothing green for wellness apps",
|
|
347
|
+
category: "healthcare",
|
|
348
|
+
colors: {
|
|
349
|
+
primary: generateColorScale2("#059669"),
|
|
350
|
+
secondary: generateColorScale2("#a7f3d0"),
|
|
351
|
+
neutral: GRAY_NEUTRAL,
|
|
352
|
+
success: "#22c55e",
|
|
353
|
+
warning: "#f59e0b",
|
|
354
|
+
error: "#ef4444",
|
|
355
|
+
info: "#3b82f6"
|
|
356
|
+
},
|
|
357
|
+
borderRadius: "lg"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: "healthcare-clean",
|
|
361
|
+
displayName: "Healthcare Clean",
|
|
362
|
+
description: "Clean, minimal healthcare theme",
|
|
363
|
+
category: "healthcare",
|
|
364
|
+
colors: {
|
|
365
|
+
primary: generateColorScale2("#0284c7"),
|
|
366
|
+
secondary: generateColorScale2("#e0f2fe"),
|
|
367
|
+
neutral: SLATE_NEUTRAL,
|
|
368
|
+
success: "#16a34a",
|
|
369
|
+
warning: "#ca8a04",
|
|
370
|
+
error: "#dc2626",
|
|
371
|
+
info: "#0284c7"
|
|
372
|
+
},
|
|
373
|
+
borderRadius: "sm",
|
|
374
|
+
shadows: "sm"
|
|
375
|
+
},
|
|
376
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
377
|
+
// FINANCE
|
|
378
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
379
|
+
{
|
|
380
|
+
name: "finance-corporate",
|
|
381
|
+
displayName: "Finance Corporate",
|
|
382
|
+
description: "Professional corporate finance theme",
|
|
383
|
+
category: "finance",
|
|
384
|
+
colors: {
|
|
385
|
+
primary: generateColorScale2("#1e40af"),
|
|
386
|
+
secondary: generateColorScale2("#047857"),
|
|
387
|
+
neutral: SLATE_NEUTRAL,
|
|
388
|
+
success: "#22c55e",
|
|
389
|
+
warning: "#f59e0b",
|
|
390
|
+
error: "#dc2626",
|
|
391
|
+
info: "#3b82f6"
|
|
392
|
+
},
|
|
393
|
+
typography: {
|
|
394
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
395
|
+
headingFontFamily: "Inter, system-ui, sans-serif"
|
|
396
|
+
},
|
|
397
|
+
borderRadius: "sm"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: "finance-modern",
|
|
401
|
+
displayName: "Finance Modern",
|
|
402
|
+
description: "Modern fintech startup theme",
|
|
403
|
+
category: "finance",
|
|
404
|
+
colors: {
|
|
405
|
+
primary: generateColorScale2("#4f46e5"),
|
|
406
|
+
secondary: generateColorScale2("#10b981"),
|
|
407
|
+
neutral: ZINC_NEUTRAL,
|
|
408
|
+
success: "#10b981",
|
|
409
|
+
warning: "#f59e0b",
|
|
410
|
+
error: "#ef4444",
|
|
411
|
+
info: "#6366f1"
|
|
412
|
+
},
|
|
413
|
+
borderRadius: "lg"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: "finance-luxury",
|
|
417
|
+
displayName: "Finance Luxury",
|
|
418
|
+
description: "Premium private banking theme",
|
|
419
|
+
category: "finance",
|
|
420
|
+
colors: {
|
|
421
|
+
primary: generateColorScale2("#1f2937"),
|
|
422
|
+
secondary: generateColorScale2("#b8860b"),
|
|
423
|
+
accent: generateColorScale2("#c4a35a"),
|
|
424
|
+
neutral: ZINC_NEUTRAL,
|
|
425
|
+
success: "#16a34a",
|
|
426
|
+
warning: "#d97706",
|
|
427
|
+
error: "#b91c1c",
|
|
428
|
+
info: "#1d4ed8"
|
|
429
|
+
},
|
|
430
|
+
borderRadius: "none"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
name: "finance-crypto",
|
|
434
|
+
displayName: "Finance Crypto",
|
|
435
|
+
description: "Dark theme for crypto trading",
|
|
436
|
+
category: "finance",
|
|
437
|
+
colors: {
|
|
438
|
+
primary: generateColorScale2("#f7931a"),
|
|
439
|
+
secondary: generateColorScale2("#627eea"),
|
|
440
|
+
neutral: {
|
|
441
|
+
50: "#0a0a0a",
|
|
442
|
+
100: "#171717",
|
|
443
|
+
200: "#262626",
|
|
444
|
+
300: "#404040",
|
|
445
|
+
400: "#525252",
|
|
446
|
+
500: "#737373",
|
|
447
|
+
600: "#a3a3a3",
|
|
448
|
+
700: "#d4d4d4",
|
|
449
|
+
800: "#e5e5e5",
|
|
450
|
+
900: "#f5f5f5",
|
|
451
|
+
950: "#fafafa"
|
|
452
|
+
},
|
|
453
|
+
success: "#22c55e",
|
|
454
|
+
warning: "#f59e0b",
|
|
455
|
+
error: "#ef4444",
|
|
456
|
+
info: "#3b82f6"
|
|
457
|
+
},
|
|
458
|
+
borderRadius: "md"
|
|
459
|
+
},
|
|
460
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
461
|
+
// EDUCATION
|
|
462
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
463
|
+
{
|
|
464
|
+
name: "education-academic",
|
|
465
|
+
displayName: "Education Academic",
|
|
466
|
+
description: "Traditional academic institution theme",
|
|
467
|
+
category: "education",
|
|
468
|
+
colors: {
|
|
469
|
+
primary: generateColorScale2("#1e3a8a"),
|
|
470
|
+
secondary: generateColorScale2("#991b1b"),
|
|
471
|
+
neutral: GRAY_NEUTRAL,
|
|
472
|
+
success: "#22c55e",
|
|
473
|
+
warning: "#f59e0b",
|
|
474
|
+
error: "#dc2626",
|
|
475
|
+
info: "#3b82f6"
|
|
476
|
+
},
|
|
477
|
+
typography: {
|
|
478
|
+
fontFamily: "Georgia, serif",
|
|
479
|
+
headingFontFamily: "Georgia, serif"
|
|
480
|
+
},
|
|
481
|
+
borderRadius: "sm"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: "education-modern",
|
|
485
|
+
displayName: "Education Modern",
|
|
486
|
+
description: "Modern e-learning platform theme",
|
|
487
|
+
category: "education",
|
|
488
|
+
colors: {
|
|
489
|
+
primary: generateColorScale2("#4f46e5"),
|
|
490
|
+
secondary: generateColorScale2("#f97316"),
|
|
491
|
+
neutral: SLATE_NEUTRAL,
|
|
492
|
+
success: "#22c55e",
|
|
493
|
+
warning: "#f59e0b",
|
|
494
|
+
error: "#ef4444",
|
|
495
|
+
info: "#6366f1"
|
|
496
|
+
},
|
|
497
|
+
borderRadius: "lg"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: "education-kids",
|
|
501
|
+
displayName: "Education Kids",
|
|
502
|
+
description: "Fun, colorful theme for children",
|
|
503
|
+
category: "education",
|
|
504
|
+
colors: {
|
|
505
|
+
primary: generateColorScale2("#8b5cf6"),
|
|
506
|
+
secondary: generateColorScale2("#ec4899"),
|
|
507
|
+
accent: generateColorScale2("#fbbf24"),
|
|
508
|
+
neutral: GRAY_NEUTRAL,
|
|
509
|
+
success: "#22c55e",
|
|
510
|
+
warning: "#f59e0b",
|
|
511
|
+
error: "#ef4444",
|
|
512
|
+
info: "#3b82f6"
|
|
513
|
+
},
|
|
514
|
+
borderRadius: "full"
|
|
515
|
+
},
|
|
516
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
517
|
+
// TECHNOLOGY
|
|
518
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
519
|
+
{
|
|
520
|
+
name: "tech-startup",
|
|
521
|
+
displayName: "Tech Startup",
|
|
522
|
+
description: "Modern tech startup theme",
|
|
523
|
+
category: "technology",
|
|
524
|
+
colors: {
|
|
525
|
+
primary: generateColorScale2("#2563eb"),
|
|
526
|
+
secondary: generateColorScale2("#7c3aed"),
|
|
527
|
+
neutral: SLATE_NEUTRAL,
|
|
528
|
+
success: "#22c55e",
|
|
529
|
+
warning: "#f59e0b",
|
|
530
|
+
error: "#ef4444",
|
|
531
|
+
info: "#3b82f6"
|
|
532
|
+
},
|
|
533
|
+
borderRadius: "lg"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
name: "tech-saas",
|
|
537
|
+
displayName: "Tech SaaS",
|
|
538
|
+
description: "Clean SaaS product theme",
|
|
539
|
+
category: "technology",
|
|
540
|
+
colors: {
|
|
541
|
+
primary: generateColorScale2("#0ea5e9"),
|
|
542
|
+
secondary: generateColorScale2("#8b5cf6"),
|
|
543
|
+
neutral: GRAY_NEUTRAL,
|
|
544
|
+
success: "#22c55e",
|
|
545
|
+
warning: "#f59e0b",
|
|
546
|
+
error: "#ef4444",
|
|
547
|
+
info: "#0ea5e9"
|
|
548
|
+
},
|
|
549
|
+
borderRadius: "md"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: "tech-dark",
|
|
553
|
+
displayName: "Tech Dark",
|
|
554
|
+
description: "Developer-focused dark theme",
|
|
555
|
+
category: "technology",
|
|
556
|
+
colors: {
|
|
557
|
+
primary: generateColorScale2("#22d3ee"),
|
|
558
|
+
secondary: generateColorScale2("#a78bfa"),
|
|
559
|
+
neutral: {
|
|
560
|
+
50: "#030712",
|
|
561
|
+
100: "#0a0f1a",
|
|
562
|
+
200: "#1f2937",
|
|
563
|
+
300: "#374151",
|
|
564
|
+
400: "#6b7280",
|
|
565
|
+
500: "#9ca3af",
|
|
566
|
+
600: "#d1d5db",
|
|
567
|
+
700: "#e5e7eb",
|
|
568
|
+
800: "#f3f4f6",
|
|
569
|
+
900: "#f9fafb",
|
|
570
|
+
950: "#ffffff"
|
|
571
|
+
},
|
|
572
|
+
success: "#4ade80",
|
|
573
|
+
warning: "#fbbf24",
|
|
574
|
+
error: "#f87171",
|
|
575
|
+
info: "#38bdf8"
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
name: "tech-github",
|
|
580
|
+
displayName: "GitHub Style",
|
|
581
|
+
description: "GitHub-inspired developer theme",
|
|
582
|
+
category: "technology",
|
|
583
|
+
colors: {
|
|
584
|
+
primary: generateColorScale2("#238636"),
|
|
585
|
+
secondary: generateColorScale2("#1f6feb"),
|
|
586
|
+
neutral: ZINC_NEUTRAL,
|
|
587
|
+
success: "#238636",
|
|
588
|
+
warning: "#d29922",
|
|
589
|
+
error: "#da3633",
|
|
590
|
+
info: "#58a6ff"
|
|
591
|
+
},
|
|
592
|
+
borderRadius: "md"
|
|
593
|
+
},
|
|
594
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
595
|
+
// E-COMMERCE
|
|
596
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
597
|
+
{
|
|
598
|
+
name: "ecommerce-modern",
|
|
599
|
+
displayName: "E-commerce Modern",
|
|
600
|
+
description: "Clean modern e-commerce theme",
|
|
601
|
+
category: "ecommerce",
|
|
602
|
+
colors: {
|
|
603
|
+
primary: generateColorScale2("#111827"),
|
|
604
|
+
secondary: generateColorScale2("#6366f1"),
|
|
605
|
+
neutral: GRAY_NEUTRAL,
|
|
606
|
+
success: "#22c55e",
|
|
607
|
+
warning: "#f59e0b",
|
|
608
|
+
error: "#ef4444",
|
|
609
|
+
info: "#3b82f6"
|
|
610
|
+
},
|
|
611
|
+
borderRadius: "md"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
name: "ecommerce-fashion",
|
|
615
|
+
displayName: "E-commerce Fashion",
|
|
616
|
+
description: "Stylish fashion e-commerce theme",
|
|
617
|
+
category: "ecommerce",
|
|
618
|
+
colors: {
|
|
619
|
+
primary: generateColorScale2("#000000"),
|
|
620
|
+
secondary: generateColorScale2("#c4a35a"),
|
|
621
|
+
neutral: ZINC_NEUTRAL,
|
|
622
|
+
success: "#22c55e",
|
|
623
|
+
warning: "#f59e0b",
|
|
624
|
+
error: "#ef4444",
|
|
625
|
+
info: "#3b82f6"
|
|
626
|
+
},
|
|
627
|
+
borderRadius: "none"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: "ecommerce-organic",
|
|
631
|
+
displayName: "E-commerce Organic",
|
|
632
|
+
description: "Natural products theme",
|
|
633
|
+
category: "ecommerce",
|
|
634
|
+
colors: {
|
|
635
|
+
primary: generateColorScale2("#166534"),
|
|
636
|
+
secondary: generateColorScale2("#92400e"),
|
|
637
|
+
neutral: WARM_NEUTRAL,
|
|
638
|
+
success: "#22c55e",
|
|
639
|
+
warning: "#f59e0b",
|
|
640
|
+
error: "#dc2626",
|
|
641
|
+
info: "#0284c7"
|
|
642
|
+
},
|
|
643
|
+
borderRadius: "lg"
|
|
644
|
+
},
|
|
645
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
646
|
+
// ENTERTAINMENT
|
|
647
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
648
|
+
{
|
|
649
|
+
name: "entertainment-streaming",
|
|
650
|
+
displayName: "Streaming Service",
|
|
651
|
+
description: "Dark streaming platform theme",
|
|
652
|
+
category: "entertainment",
|
|
653
|
+
colors: {
|
|
654
|
+
primary: generateColorScale2("#e50914"),
|
|
655
|
+
secondary: generateColorScale2("#ffffff"),
|
|
656
|
+
neutral: {
|
|
657
|
+
50: "#0a0a0a",
|
|
658
|
+
100: "#141414",
|
|
659
|
+
200: "#1f1f1f",
|
|
660
|
+
300: "#2d2d2d",
|
|
661
|
+
400: "#525252",
|
|
662
|
+
500: "#737373",
|
|
663
|
+
600: "#a3a3a3",
|
|
664
|
+
700: "#d4d4d4",
|
|
665
|
+
800: "#e5e5e5",
|
|
666
|
+
900: "#f5f5f5",
|
|
667
|
+
950: "#fafafa"
|
|
668
|
+
},
|
|
669
|
+
success: "#22c55e",
|
|
670
|
+
warning: "#f59e0b",
|
|
671
|
+
error: "#e50914",
|
|
672
|
+
info: "#3b82f6"
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
name: "entertainment-gaming",
|
|
677
|
+
displayName: "Gaming",
|
|
678
|
+
description: "Vibrant gaming theme",
|
|
679
|
+
category: "entertainment",
|
|
680
|
+
colors: {
|
|
681
|
+
primary: generateColorScale2("#9333ea"),
|
|
682
|
+
secondary: generateColorScale2("#22d3ee"),
|
|
683
|
+
accent: generateColorScale2("#f43f5e"),
|
|
684
|
+
neutral: {
|
|
685
|
+
50: "#09090b",
|
|
686
|
+
100: "#18181b",
|
|
687
|
+
200: "#27272a",
|
|
688
|
+
300: "#3f3f46",
|
|
689
|
+
400: "#52525b",
|
|
690
|
+
500: "#71717a",
|
|
691
|
+
600: "#a1a1aa",
|
|
692
|
+
700: "#d4d4d8",
|
|
693
|
+
800: "#e4e4e7",
|
|
694
|
+
900: "#f4f4f5",
|
|
695
|
+
950: "#fafafa"
|
|
696
|
+
},
|
|
697
|
+
success: "#4ade80",
|
|
698
|
+
warning: "#fbbf24",
|
|
699
|
+
error: "#f43f5e",
|
|
700
|
+
info: "#22d3ee"
|
|
701
|
+
},
|
|
702
|
+
borderRadius: "md"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: "entertainment-music",
|
|
706
|
+
displayName: "Music",
|
|
707
|
+
description: "Music streaming theme",
|
|
708
|
+
category: "entertainment",
|
|
709
|
+
colors: {
|
|
710
|
+
primary: generateColorScale2("#1db954"),
|
|
711
|
+
secondary: generateColorScale2("#ffffff"),
|
|
712
|
+
neutral: {
|
|
713
|
+
50: "#121212",
|
|
714
|
+
100: "#181818",
|
|
715
|
+
200: "#282828",
|
|
716
|
+
300: "#3d3d3d",
|
|
717
|
+
400: "#535353",
|
|
718
|
+
500: "#7a7a7a",
|
|
719
|
+
600: "#b3b3b3",
|
|
720
|
+
700: "#d9d9d9",
|
|
721
|
+
800: "#ebebeb",
|
|
722
|
+
900: "#f5f5f5",
|
|
723
|
+
950: "#ffffff"
|
|
724
|
+
},
|
|
725
|
+
success: "#1db954",
|
|
726
|
+
warning: "#f59e0b",
|
|
727
|
+
error: "#e91429",
|
|
728
|
+
info: "#1e90ff"
|
|
729
|
+
}
|
|
730
|
+
},
|
|
731
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
732
|
+
// GOVERNMENT
|
|
733
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
734
|
+
{
|
|
735
|
+
name: "government-official",
|
|
736
|
+
displayName: "Government Official",
|
|
737
|
+
description: "Official government portal theme",
|
|
738
|
+
category: "government",
|
|
739
|
+
colors: {
|
|
740
|
+
primary: generateColorScale2("#1e3a8a"),
|
|
741
|
+
secondary: generateColorScale2("#991b1b"),
|
|
742
|
+
neutral: SLATE_NEUTRAL,
|
|
743
|
+
success: "#16a34a",
|
|
744
|
+
warning: "#ca8a04",
|
|
745
|
+
error: "#b91c1c",
|
|
746
|
+
info: "#1e40af"
|
|
747
|
+
},
|
|
748
|
+
borderRadius: "sm",
|
|
749
|
+
shadows: "sm"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: "government-accessible",
|
|
753
|
+
displayName: "Government Accessible",
|
|
754
|
+
description: "High contrast accessible theme",
|
|
755
|
+
category: "government",
|
|
756
|
+
colors: {
|
|
757
|
+
primary: generateColorScale2("#0f172a"),
|
|
758
|
+
secondary: generateColorScale2("#1e40af"),
|
|
759
|
+
neutral: SLATE_NEUTRAL,
|
|
760
|
+
success: "#15803d",
|
|
761
|
+
warning: "#a16207",
|
|
762
|
+
error: "#b91c1c",
|
|
763
|
+
info: "#1d4ed8"
|
|
764
|
+
},
|
|
765
|
+
borderRadius: "none"
|
|
766
|
+
},
|
|
767
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
768
|
+
// NATURE / ORGANIC
|
|
769
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
770
|
+
{
|
|
771
|
+
name: "nature-earth",
|
|
772
|
+
displayName: "Earth Tones",
|
|
773
|
+
description: "Warm earthy natural tones",
|
|
774
|
+
category: "nature",
|
|
775
|
+
colors: {
|
|
776
|
+
primary: generateColorScale2("#78350f"),
|
|
777
|
+
secondary: generateColorScale2("#166534"),
|
|
778
|
+
neutral: WARM_NEUTRAL,
|
|
779
|
+
success: "#22c55e",
|
|
780
|
+
warning: "#f59e0b",
|
|
781
|
+
error: "#dc2626",
|
|
782
|
+
info: "#0284c7"
|
|
783
|
+
},
|
|
784
|
+
borderRadius: "lg"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
name: "nature-ocean",
|
|
788
|
+
displayName: "Ocean",
|
|
789
|
+
description: "Ocean-inspired blues and teals",
|
|
790
|
+
category: "nature",
|
|
791
|
+
colors: {
|
|
792
|
+
primary: generateColorScale2("#0369a1"),
|
|
793
|
+
secondary: generateColorScale2("#0d9488"),
|
|
794
|
+
neutral: SLATE_NEUTRAL,
|
|
795
|
+
success: "#22c55e",
|
|
796
|
+
warning: "#f59e0b",
|
|
797
|
+
error: "#ef4444",
|
|
798
|
+
info: "#0ea5e9"
|
|
799
|
+
},
|
|
800
|
+
borderRadius: "md"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
name: "nature-forest",
|
|
804
|
+
displayName: "Forest",
|
|
805
|
+
description: "Deep forest greens",
|
|
806
|
+
category: "nature",
|
|
807
|
+
colors: {
|
|
808
|
+
primary: generateColorScale2("#14532d"),
|
|
809
|
+
secondary: generateColorScale2("#365314"),
|
|
810
|
+
neutral: GRAY_NEUTRAL,
|
|
811
|
+
success: "#22c55e",
|
|
812
|
+
warning: "#f59e0b",
|
|
813
|
+
error: "#dc2626",
|
|
814
|
+
info: "#3b82f6"
|
|
815
|
+
},
|
|
816
|
+
borderRadius: "md"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
name: "nature-sunset",
|
|
820
|
+
displayName: "Sunset",
|
|
821
|
+
description: "Warm sunset gradient colors",
|
|
822
|
+
category: "nature",
|
|
823
|
+
colors: {
|
|
824
|
+
primary: generateColorScale2("#ea580c"),
|
|
825
|
+
secondary: generateColorScale2("#be185d"),
|
|
826
|
+
neutral: WARM_NEUTRAL,
|
|
827
|
+
success: "#22c55e",
|
|
828
|
+
warning: "#f59e0b",
|
|
829
|
+
error: "#dc2626",
|
|
830
|
+
info: "#0ea5e9"
|
|
831
|
+
},
|
|
832
|
+
borderRadius: "lg"
|
|
833
|
+
},
|
|
834
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
835
|
+
// MINIMAL
|
|
836
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
837
|
+
{
|
|
838
|
+
name: "minimal-mono",
|
|
839
|
+
displayName: "Monochrome",
|
|
840
|
+
description: "Pure black and white minimal",
|
|
841
|
+
category: "minimal",
|
|
842
|
+
colors: {
|
|
843
|
+
primary: generateColorScale2("#000000"),
|
|
844
|
+
neutral: ZINC_NEUTRAL,
|
|
845
|
+
success: "#22c55e",
|
|
846
|
+
warning: "#f59e0b",
|
|
847
|
+
error: "#ef4444",
|
|
848
|
+
info: "#3b82f6"
|
|
849
|
+
},
|
|
850
|
+
borderRadius: "none",
|
|
851
|
+
shadows: "none"
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
name: "minimal-soft",
|
|
855
|
+
displayName: "Minimal Soft",
|
|
856
|
+
description: "Soft grays with subtle accents",
|
|
857
|
+
category: "minimal",
|
|
858
|
+
colors: {
|
|
859
|
+
primary: generateColorScale2("#4b5563"),
|
|
860
|
+
secondary: generateColorScale2("#6366f1"),
|
|
861
|
+
neutral: GRAY_NEUTRAL,
|
|
862
|
+
success: "#22c55e",
|
|
863
|
+
warning: "#f59e0b",
|
|
864
|
+
error: "#ef4444",
|
|
865
|
+
info: "#3b82f6"
|
|
866
|
+
},
|
|
867
|
+
borderRadius: "sm",
|
|
868
|
+
shadows: "sm"
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
name: "minimal-paper",
|
|
872
|
+
displayName: "Paper",
|
|
873
|
+
description: "Clean paper-like minimal theme",
|
|
874
|
+
category: "minimal",
|
|
875
|
+
colors: {
|
|
876
|
+
primary: generateColorScale2("#525252"),
|
|
877
|
+
neutral: {
|
|
878
|
+
50: "#fefefe",
|
|
879
|
+
100: "#fafafa",
|
|
880
|
+
200: "#f5f5f5",
|
|
881
|
+
300: "#e5e5e5",
|
|
882
|
+
400: "#d4d4d4",
|
|
883
|
+
500: "#a3a3a3",
|
|
884
|
+
600: "#737373",
|
|
885
|
+
700: "#525252",
|
|
886
|
+
800: "#404040",
|
|
887
|
+
900: "#262626",
|
|
888
|
+
950: "#171717"
|
|
889
|
+
},
|
|
890
|
+
success: "#16a34a",
|
|
891
|
+
warning: "#ca8a04",
|
|
892
|
+
error: "#dc2626",
|
|
893
|
+
info: "#2563eb"
|
|
894
|
+
},
|
|
895
|
+
borderRadius: "sm",
|
|
896
|
+
shadows: "sm"
|
|
897
|
+
},
|
|
898
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
899
|
+
// BOLD
|
|
900
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
901
|
+
{
|
|
902
|
+
name: "bold-neon",
|
|
903
|
+
displayName: "Neon",
|
|
904
|
+
description: "Vibrant neon colors on dark",
|
|
905
|
+
category: "bold",
|
|
906
|
+
colors: {
|
|
907
|
+
primary: generateColorScale2("#f0abfc"),
|
|
908
|
+
secondary: generateColorScale2("#22d3ee"),
|
|
909
|
+
accent: generateColorScale2("#a3e635"),
|
|
910
|
+
neutral: {
|
|
911
|
+
50: "#0a0a0a",
|
|
912
|
+
100: "#171717",
|
|
913
|
+
200: "#262626",
|
|
914
|
+
300: "#404040",
|
|
915
|
+
400: "#525252",
|
|
916
|
+
500: "#737373",
|
|
917
|
+
600: "#a3a3a3",
|
|
918
|
+
700: "#d4d4d4",
|
|
919
|
+
800: "#e5e5e5",
|
|
920
|
+
900: "#f5f5f5",
|
|
921
|
+
950: "#fafafa"
|
|
922
|
+
},
|
|
923
|
+
success: "#a3e635",
|
|
924
|
+
warning: "#fbbf24",
|
|
925
|
+
error: "#f87171",
|
|
926
|
+
info: "#38bdf8"
|
|
927
|
+
},
|
|
928
|
+
borderRadius: "full"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
name: "bold-gradient",
|
|
932
|
+
displayName: "Gradient Bold",
|
|
933
|
+
description: "Bold gradient-ready colors",
|
|
934
|
+
category: "bold",
|
|
935
|
+
colors: {
|
|
936
|
+
primary: generateColorScale2("#ec4899"),
|
|
937
|
+
secondary: generateColorScale2("#8b5cf6"),
|
|
938
|
+
accent: generateColorScale2("#06b6d4"),
|
|
939
|
+
neutral: ZINC_NEUTRAL,
|
|
940
|
+
success: "#22c55e",
|
|
941
|
+
warning: "#f59e0b",
|
|
942
|
+
error: "#ef4444",
|
|
943
|
+
info: "#3b82f6"
|
|
944
|
+
},
|
|
945
|
+
borderRadius: "lg"
|
|
946
|
+
},
|
|
947
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
948
|
+
// PLAYFUL
|
|
949
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
950
|
+
{
|
|
951
|
+
name: "playful-candy",
|
|
952
|
+
displayName: "Candy",
|
|
953
|
+
description: "Sweet candy-inspired colors",
|
|
954
|
+
category: "playful",
|
|
955
|
+
colors: {
|
|
956
|
+
primary: generateColorScale2("#ec4899"),
|
|
957
|
+
secondary: generateColorScale2("#a855f7"),
|
|
958
|
+
accent: generateColorScale2("#22d3ee"),
|
|
959
|
+
neutral: GRAY_NEUTRAL,
|
|
960
|
+
success: "#22c55e",
|
|
961
|
+
warning: "#fbbf24",
|
|
962
|
+
error: "#f43f5e",
|
|
963
|
+
info: "#3b82f6"
|
|
964
|
+
},
|
|
965
|
+
borderRadius: "full"
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
name: "playful-retro",
|
|
969
|
+
displayName: "Retro",
|
|
970
|
+
description: "Retro 80s inspired colors",
|
|
971
|
+
category: "playful",
|
|
972
|
+
colors: {
|
|
973
|
+
primary: generateColorScale2("#f472b6"),
|
|
974
|
+
secondary: generateColorScale2("#38bdf8"),
|
|
975
|
+
accent: generateColorScale2("#facc15"),
|
|
976
|
+
neutral: ZINC_NEUTRAL,
|
|
977
|
+
success: "#4ade80",
|
|
978
|
+
warning: "#fbbf24",
|
|
979
|
+
error: "#f87171",
|
|
980
|
+
info: "#38bdf8"
|
|
981
|
+
},
|
|
982
|
+
borderRadius: "lg"
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
name: "playful-pastel",
|
|
986
|
+
displayName: "Pastel",
|
|
987
|
+
description: "Soft pastel colors",
|
|
988
|
+
category: "playful",
|
|
989
|
+
colors: {
|
|
990
|
+
primary: generateColorScale2("#93c5fd"),
|
|
991
|
+
secondary: generateColorScale2("#fda4af"),
|
|
992
|
+
accent: generateColorScale2("#fde047"),
|
|
993
|
+
neutral: GRAY_NEUTRAL,
|
|
994
|
+
success: "#86efac",
|
|
995
|
+
warning: "#fde047",
|
|
996
|
+
error: "#fda4af",
|
|
997
|
+
info: "#93c5fd"
|
|
998
|
+
},
|
|
999
|
+
borderRadius: "full"
|
|
1000
|
+
},
|
|
1001
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1002
|
+
// PROFESSIONAL
|
|
1003
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1004
|
+
{
|
|
1005
|
+
name: "professional-corporate",
|
|
1006
|
+
displayName: "Corporate",
|
|
1007
|
+
description: "Traditional corporate blue",
|
|
1008
|
+
category: "professional",
|
|
1009
|
+
colors: {
|
|
1010
|
+
primary: generateColorScale2("#1e40af"),
|
|
1011
|
+
secondary: generateColorScale2("#0f766e"),
|
|
1012
|
+
neutral: SLATE_NEUTRAL,
|
|
1013
|
+
success: "#22c55e",
|
|
1014
|
+
warning: "#f59e0b",
|
|
1015
|
+
error: "#dc2626",
|
|
1016
|
+
info: "#3b82f6"
|
|
1017
|
+
},
|
|
1018
|
+
borderRadius: "sm"
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
name: "professional-law",
|
|
1022
|
+
displayName: "Legal",
|
|
1023
|
+
description: "Serious legal/consulting theme",
|
|
1024
|
+
category: "professional",
|
|
1025
|
+
colors: {
|
|
1026
|
+
primary: generateColorScale2("#1f2937"),
|
|
1027
|
+
secondary: generateColorScale2("#7c2d12"),
|
|
1028
|
+
neutral: GRAY_NEUTRAL,
|
|
1029
|
+
success: "#16a34a",
|
|
1030
|
+
warning: "#ca8a04",
|
|
1031
|
+
error: "#b91c1c",
|
|
1032
|
+
info: "#1d4ed8"
|
|
1033
|
+
},
|
|
1034
|
+
typography: {
|
|
1035
|
+
fontFamily: "Georgia, serif",
|
|
1036
|
+
headingFontFamily: "Georgia, serif"
|
|
1037
|
+
},
|
|
1038
|
+
borderRadius: "none"
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
name: "professional-consulting",
|
|
1042
|
+
displayName: "Consulting",
|
|
1043
|
+
description: "Clean consulting firm theme",
|
|
1044
|
+
category: "professional",
|
|
1045
|
+
colors: {
|
|
1046
|
+
primary: generateColorScale2("#0f172a"),
|
|
1047
|
+
secondary: generateColorScale2("#0369a1"),
|
|
1048
|
+
neutral: SLATE_NEUTRAL,
|
|
1049
|
+
success: "#22c55e",
|
|
1050
|
+
warning: "#f59e0b",
|
|
1051
|
+
error: "#dc2626",
|
|
1052
|
+
info: "#0284c7"
|
|
1053
|
+
},
|
|
1054
|
+
borderRadius: "sm"
|
|
1055
|
+
}
|
|
1056
|
+
];
|
|
1057
|
+
function getPresetsByCategory(category) {
|
|
1058
|
+
return PRESETS.filter((p) => p.category === category);
|
|
1059
|
+
}
|
|
1060
|
+
function getPresetByName(name) {
|
|
1061
|
+
return PRESETS.find((p) => p.name === name);
|
|
1062
|
+
}
|
|
1063
|
+
function getAllCategories() {
|
|
1064
|
+
return Array.from(new Set(PRESETS.map((p) => p.category)));
|
|
1065
|
+
}
|
|
1066
|
+
function presetToCssVariables(preset, prefix = "nice") {
|
|
1067
|
+
const lines = [];
|
|
1068
|
+
for (const [shade, value] of Object.entries(preset.colors.primary)) {
|
|
1069
|
+
lines.push(` --${prefix}-color-primary-${shade}: ${value};`);
|
|
1070
|
+
}
|
|
1071
|
+
if (preset.colors.secondary) {
|
|
1072
|
+
for (const [shade, value] of Object.entries(preset.colors.secondary)) {
|
|
1073
|
+
lines.push(` --${prefix}-color-secondary-${shade}: ${value};`);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
if (preset.colors.accent) {
|
|
1077
|
+
for (const [shade, value] of Object.entries(preset.colors.accent)) {
|
|
1078
|
+
lines.push(` --${prefix}-color-accent-${shade}: ${value};`);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
for (const [shade, value] of Object.entries(preset.colors.neutral)) {
|
|
1082
|
+
lines.push(` --${prefix}-color-neutral-${shade}: ${value};`);
|
|
1083
|
+
}
|
|
1084
|
+
lines.push(` --${prefix}-color-success: ${preset.colors.success};`);
|
|
1085
|
+
lines.push(` --${prefix}-color-warning: ${preset.colors.warning};`);
|
|
1086
|
+
lines.push(` --${prefix}-color-error: ${preset.colors.error};`);
|
|
1087
|
+
lines.push(` --${prefix}-color-info: ${preset.colors.info};`);
|
|
1088
|
+
return `:root {
|
|
1089
|
+
${lines.join("\n")}
|
|
1090
|
+
}`;
|
|
1091
|
+
}
|
|
1092
|
+
function presetToTokens(preset) {
|
|
1093
|
+
const colorToToken = (value) => ({ $value: value, $type: "color" });
|
|
1094
|
+
const scaleToTokens = (scale) => {
|
|
1095
|
+
const tokens = {};
|
|
1096
|
+
for (const [shade, value] of Object.entries(scale)) {
|
|
1097
|
+
tokens[shade] = colorToToken(value);
|
|
1098
|
+
}
|
|
1099
|
+
return tokens;
|
|
1100
|
+
};
|
|
1101
|
+
return {
|
|
1102
|
+
$name: preset.displayName,
|
|
1103
|
+
$description: preset.description,
|
|
1104
|
+
color: {
|
|
1105
|
+
primary: scaleToTokens(preset.colors.primary),
|
|
1106
|
+
secondary: preset.colors.secondary ? scaleToTokens(preset.colors.secondary) : void 0,
|
|
1107
|
+
accent: preset.colors.accent ? scaleToTokens(preset.colors.accent) : void 0,
|
|
1108
|
+
neutral: scaleToTokens(preset.colors.neutral),
|
|
1109
|
+
semantic: {
|
|
1110
|
+
success: colorToToken(preset.colors.success),
|
|
1111
|
+
warning: colorToToken(preset.colors.warning),
|
|
1112
|
+
error: colorToToken(preset.colors.error),
|
|
1113
|
+
info: colorToToken(preset.colors.info)
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// src/brand-kit.ts
|
|
1120
|
+
function analyzeColor(hex) {
|
|
1121
|
+
const rgb = hexToRgb2(hex);
|
|
1122
|
+
const hsl = rgbToHsl(rgb);
|
|
1123
|
+
const luminance = calculateLuminance(rgb);
|
|
1124
|
+
return {
|
|
1125
|
+
hsl,
|
|
1126
|
+
rgb,
|
|
1127
|
+
luminance,
|
|
1128
|
+
isLight: luminance > 0.5,
|
|
1129
|
+
complementary: hslToHex2((hsl[0] + 180) % 360, hsl[1], hsl[2]),
|
|
1130
|
+
analogous: [
|
|
1131
|
+
hslToHex2((hsl[0] + 30) % 360, hsl[1], hsl[2]),
|
|
1132
|
+
hslToHex2((hsl[0] - 30 + 360) % 360, hsl[1], hsl[2])
|
|
1133
|
+
],
|
|
1134
|
+
triadic: [
|
|
1135
|
+
hslToHex2((hsl[0] + 120) % 360, hsl[1], hsl[2]),
|
|
1136
|
+
hslToHex2((hsl[0] + 240) % 360, hsl[1], hsl[2])
|
|
1137
|
+
],
|
|
1138
|
+
splitComplementary: [
|
|
1139
|
+
hslToHex2((hsl[0] + 150) % 360, hsl[1], hsl[2]),
|
|
1140
|
+
hslToHex2((hsl[0] + 210) % 360, hsl[1], hsl[2])
|
|
1141
|
+
]
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
function hexToRgb2(hex) {
|
|
1145
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
1146
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
1147
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
1148
|
+
return [r, g, b];
|
|
1149
|
+
}
|
|
1150
|
+
function rgbToHsl([r, g, b]) {
|
|
1151
|
+
r /= 255;
|
|
1152
|
+
g /= 255;
|
|
1153
|
+
b /= 255;
|
|
1154
|
+
const max = Math.max(r, g, b);
|
|
1155
|
+
const min = Math.min(r, g, b);
|
|
1156
|
+
let h = 0;
|
|
1157
|
+
let s = 0;
|
|
1158
|
+
const l = (max + min) / 2;
|
|
1159
|
+
if (max !== min) {
|
|
1160
|
+
const d = max - min;
|
|
1161
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1162
|
+
switch (max) {
|
|
1163
|
+
case r:
|
|
1164
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
1165
|
+
break;
|
|
1166
|
+
case g:
|
|
1167
|
+
h = ((b - r) / d + 2) / 6;
|
|
1168
|
+
break;
|
|
1169
|
+
case b:
|
|
1170
|
+
h = ((r - g) / d + 4) / 6;
|
|
1171
|
+
break;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
return [h * 360, s * 100, l * 100];
|
|
1175
|
+
}
|
|
1176
|
+
function hslToHex2(h, s, l) {
|
|
1177
|
+
s /= 100;
|
|
1178
|
+
l /= 100;
|
|
1179
|
+
h /= 360;
|
|
1180
|
+
const hue2rgb = (p, q, t) => {
|
|
1181
|
+
if (t < 0) {
|
|
1182
|
+
t += 1;
|
|
1183
|
+
}
|
|
1184
|
+
if (t > 1) {
|
|
1185
|
+
t -= 1;
|
|
1186
|
+
}
|
|
1187
|
+
if (t < 1 / 6) {
|
|
1188
|
+
return p + (q - p) * 6 * t;
|
|
1189
|
+
}
|
|
1190
|
+
if (t < 1 / 2) {
|
|
1191
|
+
return q;
|
|
1192
|
+
}
|
|
1193
|
+
if (t < 2 / 3) {
|
|
1194
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
1195
|
+
}
|
|
1196
|
+
return p;
|
|
1197
|
+
};
|
|
1198
|
+
let r, g, b;
|
|
1199
|
+
if (s === 0) {
|
|
1200
|
+
r = g = b = l;
|
|
1201
|
+
} else {
|
|
1202
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1203
|
+
const p = 2 * l - q;
|
|
1204
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
1205
|
+
g = hue2rgb(p, q, h);
|
|
1206
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
1207
|
+
}
|
|
1208
|
+
const toHex = (n) => Math.round(n * 255).toString(16).padStart(2, "0");
|
|
1209
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
1210
|
+
}
|
|
1211
|
+
function calculateLuminance([r, g, b]) {
|
|
1212
|
+
const [rs, gs, bs] = [r, g, b].map((c) => {
|
|
1213
|
+
c /= 255;
|
|
1214
|
+
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
1215
|
+
});
|
|
1216
|
+
return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
1217
|
+
}
|
|
1218
|
+
var INDUSTRY_DEFAULTS = {
|
|
1219
|
+
technology: {
|
|
1220
|
+
typography: "modern-sans",
|
|
1221
|
+
borderRadius: "lg",
|
|
1222
|
+
shadows: "md",
|
|
1223
|
+
style: "modern"
|
|
1224
|
+
},
|
|
1225
|
+
healthcare: {
|
|
1226
|
+
typography: "modern-sans",
|
|
1227
|
+
borderRadius: "md",
|
|
1228
|
+
shadows: "sm",
|
|
1229
|
+
style: "professional"
|
|
1230
|
+
},
|
|
1231
|
+
finance: {
|
|
1232
|
+
typography: "classic-serif",
|
|
1233
|
+
borderRadius: "sm",
|
|
1234
|
+
shadows: "sm",
|
|
1235
|
+
style: "professional"
|
|
1236
|
+
},
|
|
1237
|
+
education: {
|
|
1238
|
+
typography: "modern-sans",
|
|
1239
|
+
borderRadius: "md",
|
|
1240
|
+
shadows: "md",
|
|
1241
|
+
style: "modern"
|
|
1242
|
+
},
|
|
1243
|
+
retail: {
|
|
1244
|
+
typography: "modern-sans",
|
|
1245
|
+
borderRadius: "md",
|
|
1246
|
+
shadows: "md",
|
|
1247
|
+
style: "modern"
|
|
1248
|
+
},
|
|
1249
|
+
hospitality: {
|
|
1250
|
+
typography: "classic-serif",
|
|
1251
|
+
borderRadius: "lg",
|
|
1252
|
+
shadows: "md",
|
|
1253
|
+
style: "luxury"
|
|
1254
|
+
},
|
|
1255
|
+
manufacturing: {
|
|
1256
|
+
typography: "modern-sans",
|
|
1257
|
+
borderRadius: "sm",
|
|
1258
|
+
shadows: "sm",
|
|
1259
|
+
style: "professional"
|
|
1260
|
+
},
|
|
1261
|
+
creative: {
|
|
1262
|
+
typography: "geometric",
|
|
1263
|
+
borderRadius: "lg",
|
|
1264
|
+
shadows: "lg",
|
|
1265
|
+
style: "bold"
|
|
1266
|
+
},
|
|
1267
|
+
nonprofit: {
|
|
1268
|
+
typography: "modern-sans",
|
|
1269
|
+
borderRadius: "md",
|
|
1270
|
+
shadows: "sm",
|
|
1271
|
+
style: "organic"
|
|
1272
|
+
},
|
|
1273
|
+
government: {
|
|
1274
|
+
typography: "modern-sans",
|
|
1275
|
+
borderRadius: "none",
|
|
1276
|
+
shadows: "sm",
|
|
1277
|
+
style: "professional"
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
var TYPOGRAPHY_STACKS = {
|
|
1281
|
+
"modern-sans": {
|
|
1282
|
+
body: "Inter, system-ui, -apple-system, sans-serif",
|
|
1283
|
+
heading: "Inter, system-ui, -apple-system, sans-serif"
|
|
1284
|
+
},
|
|
1285
|
+
"classic-serif": {
|
|
1286
|
+
body: 'Georgia, Cambria, "Times New Roman", serif',
|
|
1287
|
+
heading: 'Georgia, Cambria, "Times New Roman", serif'
|
|
1288
|
+
},
|
|
1289
|
+
geometric: {
|
|
1290
|
+
body: 'Poppins, "Segoe UI", Roboto, sans-serif',
|
|
1291
|
+
heading: 'Poppins, "Segoe UI", Roboto, sans-serif'
|
|
1292
|
+
},
|
|
1293
|
+
rounded: {
|
|
1294
|
+
body: 'Nunito, "Segoe UI", Roboto, sans-serif',
|
|
1295
|
+
heading: 'Nunito, "Segoe UI", Roboto, sans-serif'
|
|
1296
|
+
},
|
|
1297
|
+
monospace: {
|
|
1298
|
+
body: '"JetBrains Mono", "Fira Code", Consolas, monospace',
|
|
1299
|
+
heading: '"JetBrains Mono", "Fira Code", Consolas, monospace'
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
function generateNeutralPalette(primaryColor) {
|
|
1303
|
+
const analysis = analyzeColor(primaryColor);
|
|
1304
|
+
const [h] = analysis.hsl;
|
|
1305
|
+
return {
|
|
1306
|
+
50: hslToHex2(h, 5, 98),
|
|
1307
|
+
100: hslToHex2(h, 5, 96),
|
|
1308
|
+
200: hslToHex2(h, 5, 90),
|
|
1309
|
+
300: hslToHex2(h, 5, 83),
|
|
1310
|
+
400: hslToHex2(h, 5, 64),
|
|
1311
|
+
500: hslToHex2(h, 5, 45),
|
|
1312
|
+
600: hslToHex2(h, 5, 32),
|
|
1313
|
+
700: hslToHex2(h, 5, 25),
|
|
1314
|
+
800: hslToHex2(h, 5, 15),
|
|
1315
|
+
900: hslToHex2(h, 5, 9),
|
|
1316
|
+
950: hslToHex2(h, 5, 4)
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
function generateBrandKit(config) {
|
|
1320
|
+
const defaults = config.industry ? INDUSTRY_DEFAULTS[config.industry] : {};
|
|
1321
|
+
const mergedConfig = { ...defaults, ...config };
|
|
1322
|
+
const primaryAnalysis = analyzeColor(config.primaryColor);
|
|
1323
|
+
const secondaryColor = config.secondaryColor || primaryAnalysis.complementary;
|
|
1324
|
+
const accentColor = config.accentColor || primaryAnalysis.analogous[0];
|
|
1325
|
+
const primaryScale = generateColorScale2(config.primaryColor);
|
|
1326
|
+
const secondaryScale = generateColorScale2(secondaryColor);
|
|
1327
|
+
const accentScale = generateColorScale2(accentColor);
|
|
1328
|
+
const neutralScale = generateNeutralPalette(config.primaryColor);
|
|
1329
|
+
const semanticColors = generateSemanticColors(mergedConfig.style || "modern");
|
|
1330
|
+
const preset = {
|
|
1331
|
+
name: `brand-${config.brandName.toLowerCase().replace(/\s+/g, "-")}`,
|
|
1332
|
+
displayName: config.brandName,
|
|
1333
|
+
description: `Custom brand theme for ${config.brandName}`,
|
|
1334
|
+
category: "brand",
|
|
1335
|
+
colors: {
|
|
1336
|
+
primary: primaryScale,
|
|
1337
|
+
secondary: secondaryScale,
|
|
1338
|
+
accent: accentScale,
|
|
1339
|
+
neutral: neutralScale,
|
|
1340
|
+
...semanticColors
|
|
1341
|
+
},
|
|
1342
|
+
typography: {
|
|
1343
|
+
fontFamily: TYPOGRAPHY_STACKS[mergedConfig.typography || "modern-sans"].body,
|
|
1344
|
+
headingFontFamily: TYPOGRAPHY_STACKS[mergedConfig.typography || "modern-sans"].heading
|
|
1345
|
+
},
|
|
1346
|
+
borderRadius: mergedConfig.borderRadius,
|
|
1347
|
+
shadows: mergedConfig.shadows
|
|
1348
|
+
};
|
|
1349
|
+
const darkMode = generateDarkModePreset(preset);
|
|
1350
|
+
const css = generateCssFromPreset(preset);
|
|
1351
|
+
const tokens = generateTokensFromPreset(preset);
|
|
1352
|
+
const assets = generateBrandAssets(preset, mergedConfig);
|
|
1353
|
+
return {
|
|
1354
|
+
preset,
|
|
1355
|
+
css,
|
|
1356
|
+
tokens,
|
|
1357
|
+
darkMode,
|
|
1358
|
+
assets
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
function generateSemanticColors(style) {
|
|
1362
|
+
const semantics = {
|
|
1363
|
+
professional: { success: "#16a34a", warning: "#ca8a04", error: "#dc2626", info: "#2563eb" },
|
|
1364
|
+
modern: { success: "#22c55e", warning: "#f59e0b", error: "#ef4444", info: "#3b82f6" },
|
|
1365
|
+
playful: { success: "#4ade80", warning: "#fbbf24", error: "#f87171", info: "#60a5fa" },
|
|
1366
|
+
minimal: { success: "#22c55e", warning: "#f59e0b", error: "#ef4444", info: "#3b82f6" },
|
|
1367
|
+
bold: { success: "#22c55e", warning: "#f59e0b", error: "#ef4444", info: "#3b82f6" },
|
|
1368
|
+
luxury: { success: "#15803d", warning: "#a16207", error: "#b91c1c", info: "#1e40af" },
|
|
1369
|
+
organic: { success: "#16a34a", warning: "#d97706", error: "#dc2626", info: "#0284c7" }
|
|
1370
|
+
};
|
|
1371
|
+
return semantics[style];
|
|
1372
|
+
}
|
|
1373
|
+
function generateDarkModePreset(lightPreset) {
|
|
1374
|
+
const invertedNeutral = {
|
|
1375
|
+
50: lightPreset.colors.neutral[950],
|
|
1376
|
+
100: lightPreset.colors.neutral[900],
|
|
1377
|
+
200: lightPreset.colors.neutral[800],
|
|
1378
|
+
300: lightPreset.colors.neutral[700],
|
|
1379
|
+
400: lightPreset.colors.neutral[600],
|
|
1380
|
+
500: lightPreset.colors.neutral[500],
|
|
1381
|
+
600: lightPreset.colors.neutral[400],
|
|
1382
|
+
700: lightPreset.colors.neutral[300],
|
|
1383
|
+
800: lightPreset.colors.neutral[200],
|
|
1384
|
+
900: lightPreset.colors.neutral[100],
|
|
1385
|
+
950: lightPreset.colors.neutral[50]
|
|
1386
|
+
};
|
|
1387
|
+
return {
|
|
1388
|
+
...lightPreset,
|
|
1389
|
+
name: `${lightPreset.name}-dark`,
|
|
1390
|
+
displayName: `${lightPreset.displayName} (Dark)`,
|
|
1391
|
+
colors: {
|
|
1392
|
+
...lightPreset.colors,
|
|
1393
|
+
neutral: invertedNeutral
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
function generateCssFromPreset(preset) {
|
|
1398
|
+
const lines = [
|
|
1399
|
+
`/* ${preset.displayName} Theme */`,
|
|
1400
|
+
`/* Generated by Nice2Dev Brand Kit */`,
|
|
1401
|
+
"",
|
|
1402
|
+
":root {"
|
|
1403
|
+
];
|
|
1404
|
+
for (const [shade, value] of Object.entries(preset.colors.primary)) {
|
|
1405
|
+
lines.push(` --nice-color-primary-${shade}: ${value};`);
|
|
1406
|
+
}
|
|
1407
|
+
if (preset.colors.secondary) {
|
|
1408
|
+
for (const [shade, value] of Object.entries(preset.colors.secondary)) {
|
|
1409
|
+
lines.push(` --nice-color-secondary-${shade}: ${value};`);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
if (preset.colors.accent) {
|
|
1413
|
+
for (const [shade, value] of Object.entries(preset.colors.accent)) {
|
|
1414
|
+
lines.push(` --nice-color-accent-${shade}: ${value};`);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
for (const [shade, value] of Object.entries(preset.colors.neutral)) {
|
|
1418
|
+
lines.push(` --nice-color-neutral-${shade}: ${value};`);
|
|
1419
|
+
}
|
|
1420
|
+
lines.push(` --nice-color-success: ${preset.colors.success};`);
|
|
1421
|
+
lines.push(` --nice-color-warning: ${preset.colors.warning};`);
|
|
1422
|
+
lines.push(` --nice-color-error: ${preset.colors.error};`);
|
|
1423
|
+
lines.push(` --nice-color-info: ${preset.colors.info};`);
|
|
1424
|
+
if (preset.typography) {
|
|
1425
|
+
lines.push(` --nice-font-family-body: ${preset.typography.fontFamily};`);
|
|
1426
|
+
lines.push(
|
|
1427
|
+
` --nice-font-family-heading: ${preset.typography.headingFontFamily || preset.typography.fontFamily};`
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
const radiusMap = { none: "0", sm: "0.25rem", md: "0.5rem", lg: "1rem", full: "9999px" };
|
|
1431
|
+
if (preset.borderRadius) {
|
|
1432
|
+
lines.push(` --nice-radius-base: ${radiusMap[preset.borderRadius]};`);
|
|
1433
|
+
}
|
|
1434
|
+
lines.push("}");
|
|
1435
|
+
return lines.join("\n");
|
|
1436
|
+
}
|
|
1437
|
+
function generateTokensFromPreset(preset) {
|
|
1438
|
+
const colorToToken = (value) => ({ $value: value, $type: "color" });
|
|
1439
|
+
const scaleToTokens = (scale) => {
|
|
1440
|
+
const tokens = {};
|
|
1441
|
+
for (const [shade, value] of Object.entries(scale)) {
|
|
1442
|
+
tokens[shade] = colorToToken(value);
|
|
1443
|
+
}
|
|
1444
|
+
return tokens;
|
|
1445
|
+
};
|
|
1446
|
+
return {
|
|
1447
|
+
$name: preset.displayName,
|
|
1448
|
+
$description: preset.description,
|
|
1449
|
+
color: {
|
|
1450
|
+
primary: scaleToTokens(preset.colors.primary),
|
|
1451
|
+
secondary: preset.colors.secondary ? scaleToTokens(preset.colors.secondary) : void 0,
|
|
1452
|
+
accent: preset.colors.accent ? scaleToTokens(preset.colors.accent) : void 0,
|
|
1453
|
+
neutral: scaleToTokens(preset.colors.neutral),
|
|
1454
|
+
semantic: {
|
|
1455
|
+
success: colorToToken(preset.colors.success),
|
|
1456
|
+
warning: colorToToken(preset.colors.warning),
|
|
1457
|
+
error: colorToToken(preset.colors.error),
|
|
1458
|
+
info: colorToToken(preset.colors.info)
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
typography: preset.typography ? {
|
|
1462
|
+
fontFamily: {
|
|
1463
|
+
body: { $value: [preset.typography.fontFamily], $type: "fontFamily" },
|
|
1464
|
+
heading: {
|
|
1465
|
+
$value: [preset.typography.headingFontFamily || preset.typography.fontFamily],
|
|
1466
|
+
$type: "fontFamily"
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
} : void 0
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function generateBrandAssets(preset, config) {
|
|
1473
|
+
const colorPalette = [
|
|
1474
|
+
{
|
|
1475
|
+
name: "Primary",
|
|
1476
|
+
colors: Object.entries(preset.colors.primary).map(([shade, hex]) => ({
|
|
1477
|
+
shade,
|
|
1478
|
+
hex,
|
|
1479
|
+
usage: shade === "500" ? "Main brand color" : shade === "600" ? "Hover states" : shade === "700" ? "Active states" : "Supporting"
|
|
1480
|
+
}))
|
|
1481
|
+
}
|
|
1482
|
+
];
|
|
1483
|
+
if (preset.colors.secondary) {
|
|
1484
|
+
colorPalette.push({
|
|
1485
|
+
name: "Secondary",
|
|
1486
|
+
colors: Object.entries(preset.colors.secondary).map(([shade, hex]) => ({
|
|
1487
|
+
shade,
|
|
1488
|
+
hex,
|
|
1489
|
+
usage: shade === "500" ? "Secondary actions" : "Supporting"
|
|
1490
|
+
}))
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
const typographyScale = [
|
|
1494
|
+
{
|
|
1495
|
+
name: "Display",
|
|
1496
|
+
size: "3.75rem",
|
|
1497
|
+
weight: 700,
|
|
1498
|
+
lineHeight: 1,
|
|
1499
|
+
usage: "Hero sections, large headings"
|
|
1500
|
+
},
|
|
1501
|
+
{ name: "H1", size: "2.25rem", weight: 700, lineHeight: 1.2, usage: "Page titles" },
|
|
1502
|
+
{ name: "H2", size: "1.875rem", weight: 600, lineHeight: 1.3, usage: "Section headings" },
|
|
1503
|
+
{ name: "H3", size: "1.5rem", weight: 600, lineHeight: 1.4, usage: "Card titles" },
|
|
1504
|
+
{ name: "H4", size: "1.25rem", weight: 600, lineHeight: 1.4, usage: "Subsections" },
|
|
1505
|
+
{
|
|
1506
|
+
name: "Body Large",
|
|
1507
|
+
size: "1.125rem",
|
|
1508
|
+
weight: 400,
|
|
1509
|
+
lineHeight: 1.6,
|
|
1510
|
+
usage: "Lead paragraphs"
|
|
1511
|
+
},
|
|
1512
|
+
{ name: "Body", size: "1rem", weight: 400, lineHeight: 1.5, usage: "Main content" },
|
|
1513
|
+
{ name: "Body Small", size: "0.875rem", weight: 400, lineHeight: 1.5, usage: "Secondary text" },
|
|
1514
|
+
{ name: "Caption", size: "0.75rem", weight: 400, lineHeight: 1.4, usage: "Labels, hints" }
|
|
1515
|
+
];
|
|
1516
|
+
const spacingScale = [
|
|
1517
|
+
{ name: "xs", value: "0.25rem", usage: "Tight spacing" },
|
|
1518
|
+
{ name: "sm", value: "0.5rem", usage: "Compact elements" },
|
|
1519
|
+
{ name: "md", value: "1rem", usage: "Standard spacing" },
|
|
1520
|
+
{ name: "lg", value: "1.5rem", usage: "Section spacing" },
|
|
1521
|
+
{ name: "xl", value: "2rem", usage: "Large gaps" },
|
|
1522
|
+
{ name: "2xl", value: "3rem", usage: "Section dividers" }
|
|
1523
|
+
];
|
|
1524
|
+
const logoUsageGuidelines = `
|
|
1525
|
+
# ${config.brandName || "Brand"} Logo Usage Guidelines
|
|
1526
|
+
|
|
1527
|
+
## Minimum Size
|
|
1528
|
+
- Digital: 24px height minimum
|
|
1529
|
+
- Print: 12mm height minimum
|
|
1530
|
+
|
|
1531
|
+
## Clear Space
|
|
1532
|
+
- Maintain clear space equal to the height of the logo mark
|
|
1533
|
+
|
|
1534
|
+
## Color Variations
|
|
1535
|
+
- Primary: Use on light backgrounds (${preset.colors.primary[500]})
|
|
1536
|
+
- Reversed: Use on dark backgrounds (white or ${preset.colors.neutral[50]})
|
|
1537
|
+
- Monochrome: For limited color applications
|
|
1538
|
+
|
|
1539
|
+
## Don'ts
|
|
1540
|
+
- Don't stretch or distort
|
|
1541
|
+
- Don't rotate
|
|
1542
|
+
- Don't apply effects or shadows
|
|
1543
|
+
- Don't change colors outside brand palette
|
|
1544
|
+
- Don't place on busy backgrounds
|
|
1545
|
+
`.trim();
|
|
1546
|
+
return {
|
|
1547
|
+
colorPalette,
|
|
1548
|
+
typographyScale,
|
|
1549
|
+
spacingScale,
|
|
1550
|
+
logoUsageGuidelines
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
function quickBrandKit(primaryColor, brandName = "My Brand") {
|
|
1554
|
+
return generateBrandKit({
|
|
1555
|
+
primaryColor,
|
|
1556
|
+
brandName,
|
|
1557
|
+
industry: "technology",
|
|
1558
|
+
style: "modern"
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
function industryBrandKit(primaryColor, brandName, industry) {
|
|
1562
|
+
return generateBrandKit({
|
|
1563
|
+
primaryColor,
|
|
1564
|
+
brandName,
|
|
1565
|
+
industry
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// src/accessibility.ts
|
|
1570
|
+
var STANDARD_MOTION = {
|
|
1571
|
+
duration: {
|
|
1572
|
+
instant: "0ms",
|
|
1573
|
+
fast: "100ms",
|
|
1574
|
+
normal: "200ms",
|
|
1575
|
+
slow: "300ms",
|
|
1576
|
+
slower: "500ms",
|
|
1577
|
+
slowest: "1000ms"
|
|
1578
|
+
},
|
|
1579
|
+
easing: {
|
|
1580
|
+
linear: "linear",
|
|
1581
|
+
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
|
1582
|
+
easeOut: "cubic-bezier(0, 0, 0.2, 1)",
|
|
1583
|
+
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1584
|
+
spring: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
1585
|
+
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
|
|
1586
|
+
},
|
|
1587
|
+
transition: {
|
|
1588
|
+
none: "none",
|
|
1589
|
+
all: "all 200ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1590
|
+
colors: "color, background-color, border-color 200ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1591
|
+
opacity: "opacity 200ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1592
|
+
transform: "transform 200ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1593
|
+
shadow: "box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
var REDUCED_MOTION = {
|
|
1597
|
+
duration: {
|
|
1598
|
+
instant: "0ms",
|
|
1599
|
+
fast: "0ms",
|
|
1600
|
+
normal: "0ms",
|
|
1601
|
+
slow: "0ms",
|
|
1602
|
+
slower: "0ms",
|
|
1603
|
+
slowest: "0ms"
|
|
1604
|
+
},
|
|
1605
|
+
easing: {
|
|
1606
|
+
linear: "linear",
|
|
1607
|
+
easeIn: "linear",
|
|
1608
|
+
easeOut: "linear",
|
|
1609
|
+
easeInOut: "linear",
|
|
1610
|
+
spring: "linear",
|
|
1611
|
+
bounce: "linear"
|
|
1612
|
+
},
|
|
1613
|
+
transition: {
|
|
1614
|
+
none: "none",
|
|
1615
|
+
all: "none",
|
|
1616
|
+
colors: "none",
|
|
1617
|
+
opacity: "opacity 0ms linear",
|
|
1618
|
+
transform: "none",
|
|
1619
|
+
shadow: "none"
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1622
|
+
var MINIMAL_MOTION = {
|
|
1623
|
+
duration: {
|
|
1624
|
+
instant: "0ms",
|
|
1625
|
+
fast: "50ms",
|
|
1626
|
+
normal: "100ms",
|
|
1627
|
+
slow: "150ms",
|
|
1628
|
+
slower: "200ms",
|
|
1629
|
+
slowest: "300ms"
|
|
1630
|
+
},
|
|
1631
|
+
easing: {
|
|
1632
|
+
linear: "linear",
|
|
1633
|
+
easeIn: "linear",
|
|
1634
|
+
easeOut: "linear",
|
|
1635
|
+
easeInOut: "linear",
|
|
1636
|
+
spring: "linear",
|
|
1637
|
+
bounce: "linear"
|
|
1638
|
+
},
|
|
1639
|
+
transition: {
|
|
1640
|
+
none: "none",
|
|
1641
|
+
all: "opacity 100ms linear",
|
|
1642
|
+
colors: "color, background-color 100ms linear",
|
|
1643
|
+
opacity: "opacity 100ms linear",
|
|
1644
|
+
transform: "none",
|
|
1645
|
+
shadow: "none"
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
var STANDARD_FOCUS = {
|
|
1649
|
+
ring: {
|
|
1650
|
+
width: "2px",
|
|
1651
|
+
offset: "2px",
|
|
1652
|
+
color: "var(--nice-color-primary-500)",
|
|
1653
|
+
style: "solid"
|
|
1654
|
+
},
|
|
1655
|
+
outline: {
|
|
1656
|
+
width: "2px",
|
|
1657
|
+
style: "solid",
|
|
1658
|
+
color: "var(--nice-color-primary-500)",
|
|
1659
|
+
offset: "2px"
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
var ENHANCED_FOCUS = {
|
|
1663
|
+
ring: {
|
|
1664
|
+
width: "3px",
|
|
1665
|
+
offset: "3px",
|
|
1666
|
+
color: "var(--nice-color-primary-600)",
|
|
1667
|
+
style: "solid"
|
|
1668
|
+
},
|
|
1669
|
+
outline: {
|
|
1670
|
+
width: "3px",
|
|
1671
|
+
style: "solid",
|
|
1672
|
+
color: "var(--nice-color-primary-600)",
|
|
1673
|
+
offset: "3px"
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
var HIGH_VISIBILITY_FOCUS = {
|
|
1677
|
+
ring: {
|
|
1678
|
+
width: "4px",
|
|
1679
|
+
offset: "4px",
|
|
1680
|
+
color: "#000000",
|
|
1681
|
+
style: "solid"
|
|
1682
|
+
},
|
|
1683
|
+
outline: {
|
|
1684
|
+
width: "4px",
|
|
1685
|
+
style: "solid",
|
|
1686
|
+
color: "#000000",
|
|
1687
|
+
offset: "4px"
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
var STANDARD_CONTRAST = {
|
|
1691
|
+
text: {
|
|
1692
|
+
primary: "#111827",
|
|
1693
|
+
secondary: "#374151",
|
|
1694
|
+
tertiary: "#6b7280",
|
|
1695
|
+
disabled: "#9ca3af",
|
|
1696
|
+
inverse: "#ffffff"
|
|
1697
|
+
},
|
|
1698
|
+
background: {
|
|
1699
|
+
primary: "#ffffff",
|
|
1700
|
+
secondary: "#f9fafb",
|
|
1701
|
+
tertiary: "#f3f4f6",
|
|
1702
|
+
elevated: "#ffffff",
|
|
1703
|
+
overlay: "rgba(0, 0, 0, 0.5)"
|
|
1704
|
+
},
|
|
1705
|
+
border: {
|
|
1706
|
+
default: "#e5e7eb",
|
|
1707
|
+
strong: "#d1d5db",
|
|
1708
|
+
focus: "#3b82f6"
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
var HIGH_CONTRAST = {
|
|
1712
|
+
text: {
|
|
1713
|
+
primary: "#000000",
|
|
1714
|
+
secondary: "#1a1a1a",
|
|
1715
|
+
tertiary: "#333333",
|
|
1716
|
+
disabled: "#666666",
|
|
1717
|
+
inverse: "#ffffff"
|
|
1718
|
+
},
|
|
1719
|
+
background: {
|
|
1720
|
+
primary: "#ffffff",
|
|
1721
|
+
secondary: "#f5f5f5",
|
|
1722
|
+
tertiary: "#ebebeb",
|
|
1723
|
+
elevated: "#ffffff",
|
|
1724
|
+
overlay: "rgba(0, 0, 0, 0.7)"
|
|
1725
|
+
},
|
|
1726
|
+
border: {
|
|
1727
|
+
default: "#000000",
|
|
1728
|
+
strong: "#000000",
|
|
1729
|
+
focus: "#0000cc"
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
var HIGH_CONTRAST_DARK = {
|
|
1733
|
+
text: {
|
|
1734
|
+
primary: "#ffffff",
|
|
1735
|
+
secondary: "#f0f0f0",
|
|
1736
|
+
tertiary: "#e0e0e0",
|
|
1737
|
+
disabled: "#999999",
|
|
1738
|
+
inverse: "#000000"
|
|
1739
|
+
},
|
|
1740
|
+
background: {
|
|
1741
|
+
primary: "#000000",
|
|
1742
|
+
secondary: "#0a0a0a",
|
|
1743
|
+
tertiary: "#141414",
|
|
1744
|
+
elevated: "#1a1a1a",
|
|
1745
|
+
overlay: "rgba(255, 255, 255, 0.3)"
|
|
1746
|
+
},
|
|
1747
|
+
border: {
|
|
1748
|
+
default: "#ffffff",
|
|
1749
|
+
strong: "#ffffff",
|
|
1750
|
+
focus: "#ffff00"
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1753
|
+
var STANDARD_TYPOGRAPHY = {
|
|
1754
|
+
minSize: "1rem",
|
|
1755
|
+
lineHeight: "1.5",
|
|
1756
|
+
letterSpacing: "normal",
|
|
1757
|
+
wordSpacing: "normal"
|
|
1758
|
+
};
|
|
1759
|
+
var ENHANCED_TYPOGRAPHY = {
|
|
1760
|
+
minSize: "1.125rem",
|
|
1761
|
+
lineHeight: "1.75",
|
|
1762
|
+
letterSpacing: "0.02em",
|
|
1763
|
+
wordSpacing: "0.05em"
|
|
1764
|
+
};
|
|
1765
|
+
var MAXIMUM_READABILITY_TYPOGRAPHY = {
|
|
1766
|
+
minSize: "1.25rem",
|
|
1767
|
+
lineHeight: "2",
|
|
1768
|
+
letterSpacing: "0.05em",
|
|
1769
|
+
wordSpacing: "0.1em"
|
|
1770
|
+
};
|
|
1771
|
+
function generateReducedMotionCss(config = {}) {
|
|
1772
|
+
const motion = config.allowReducedAnimations ? MINIMAL_MOTION : REDUCED_MOTION;
|
|
1773
|
+
return `
|
|
1774
|
+
/* Reduced Motion Styles */
|
|
1775
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1776
|
+
*,
|
|
1777
|
+
*::before,
|
|
1778
|
+
*::after {
|
|
1779
|
+
animation-duration: ${motion.duration.instant} !important;
|
|
1780
|
+
animation-iteration-count: 1 !important;
|
|
1781
|
+
transition-duration: ${motion.duration.instant} !important;
|
|
1782
|
+
scroll-behavior: auto !important;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/* Preserve essential state changes */
|
|
1786
|
+
[data-state] {
|
|
1787
|
+
transition: opacity ${config.allowReducedAnimations ? "100ms" : "0ms"} linear !important;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
/* Reduced motion utility classes */
|
|
1792
|
+
.reduce-motion {
|
|
1793
|
+
animation: none !important;
|
|
1794
|
+
transition: none !important;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
.reduce-motion-safe {
|
|
1798
|
+
animation-duration: ${motion.duration.normal} !important;
|
|
1799
|
+
transition-duration: ${motion.duration.normal} !important;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
${config.disableParallax ? `
|
|
1803
|
+
/* Disable parallax */
|
|
1804
|
+
.parallax,
|
|
1805
|
+
[data-parallax] {
|
|
1806
|
+
transform: none !important;
|
|
1807
|
+
position: relative !important;
|
|
1808
|
+
}
|
|
1809
|
+
` : ""}
|
|
1810
|
+
|
|
1811
|
+
${config.disableAutoPlay ? `
|
|
1812
|
+
/* Disable autoplay */
|
|
1813
|
+
video[autoplay],
|
|
1814
|
+
[data-autoplay] {
|
|
1815
|
+
animation-play-state: paused !important;
|
|
1816
|
+
}
|
|
1817
|
+
` : ""}
|
|
1818
|
+
`.trim();
|
|
1819
|
+
}
|
|
1820
|
+
function generateFocusCss(tokens = ENHANCED_FOCUS) {
|
|
1821
|
+
return `
|
|
1822
|
+
/* Enhanced Focus Styles */
|
|
1823
|
+
:focus-visible {
|
|
1824
|
+
outline: ${tokens.outline.width} ${tokens.outline.style} ${tokens.outline.color};
|
|
1825
|
+
outline-offset: ${tokens.outline.offset};
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/* Focus ring utility */
|
|
1829
|
+
.focus-ring:focus-visible {
|
|
1830
|
+
box-shadow: 0 0 0 ${tokens.ring.offset} var(--nice-color-background, #fff),
|
|
1831
|
+
0 0 0 calc(${tokens.ring.offset} + ${tokens.ring.width}) ${tokens.ring.color};
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
/* Skip links */
|
|
1835
|
+
.skip-link {
|
|
1836
|
+
position: absolute;
|
|
1837
|
+
top: -40px;
|
|
1838
|
+
left: 0;
|
|
1839
|
+
padding: 8px 16px;
|
|
1840
|
+
background: ${tokens.ring.color};
|
|
1841
|
+
color: white;
|
|
1842
|
+
z-index: 100;
|
|
1843
|
+
transition: top 200ms ease;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
.skip-link:focus {
|
|
1847
|
+
top: 0;
|
|
1848
|
+
}
|
|
1849
|
+
`.trim();
|
|
1850
|
+
}
|
|
1851
|
+
function generateHighContrastCss(tokens = HIGH_CONTRAST) {
|
|
1852
|
+
return `
|
|
1853
|
+
/* High Contrast Mode */
|
|
1854
|
+
@media (prefers-contrast: more) {
|
|
1855
|
+
:root {
|
|
1856
|
+
--nice-text-primary: ${tokens.text.primary};
|
|
1857
|
+
--nice-text-secondary: ${tokens.text.secondary};
|
|
1858
|
+
--nice-text-tertiary: ${tokens.text.tertiary};
|
|
1859
|
+
--nice-text-disabled: ${tokens.text.disabled};
|
|
1860
|
+
--nice-bg-primary: ${tokens.background.primary};
|
|
1861
|
+
--nice-bg-secondary: ${tokens.background.secondary};
|
|
1862
|
+
--nice-bg-tertiary: ${tokens.background.tertiary};
|
|
1863
|
+
--nice-border-default: ${tokens.border.default};
|
|
1864
|
+
--nice-border-strong: ${tokens.border.strong};
|
|
1865
|
+
--nice-border-focus: ${tokens.border.focus};
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/* Ensure minimum contrast */
|
|
1869
|
+
* {
|
|
1870
|
+
border-color: ${tokens.border.default} !important;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
/* No transparent backgrounds */
|
|
1874
|
+
button,
|
|
1875
|
+
input,
|
|
1876
|
+
select,
|
|
1877
|
+
textarea {
|
|
1878
|
+
background-color: ${tokens.background.primary} !important;
|
|
1879
|
+
border: 2px solid ${tokens.border.default} !important;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
/* High contrast utility classes */
|
|
1884
|
+
.high-contrast {
|
|
1885
|
+
--nice-text-primary: ${tokens.text.primary};
|
|
1886
|
+
--nice-bg-primary: ${tokens.background.primary};
|
|
1887
|
+
--nice-border-default: ${tokens.border.default};
|
|
1888
|
+
}
|
|
1889
|
+
`.trim();
|
|
1890
|
+
}
|
|
1891
|
+
function generateAccessibilityCss(options = {}) {
|
|
1892
|
+
const sections = [];
|
|
1893
|
+
sections.push(generateReducedMotionCss(options.reducedMotion));
|
|
1894
|
+
sections.push(generateFocusCss(options.focus));
|
|
1895
|
+
sections.push(generateHighContrastCss(options.contrast));
|
|
1896
|
+
if (options.typography) {
|
|
1897
|
+
sections.push(
|
|
1898
|
+
`
|
|
1899
|
+
/* Enhanced Typography */
|
|
1900
|
+
.enhanced-readability {
|
|
1901
|
+
font-size: ${options.typography.minSize};
|
|
1902
|
+
line-height: ${options.typography.lineHeight};
|
|
1903
|
+
letter-spacing: ${options.typography.letterSpacing};
|
|
1904
|
+
word-spacing: ${options.typography.wordSpacing};
|
|
1905
|
+
}
|
|
1906
|
+
`.trim()
|
|
1907
|
+
);
|
|
1908
|
+
}
|
|
1909
|
+
return sections.join("\n\n");
|
|
1910
|
+
}
|
|
1911
|
+
var STANDARD_ACCESSIBILITY = {
|
|
1912
|
+
motion: STANDARD_MOTION,
|
|
1913
|
+
focus: STANDARD_FOCUS,
|
|
1914
|
+
contrast: STANDARD_CONTRAST,
|
|
1915
|
+
typography: STANDARD_TYPOGRAPHY
|
|
1916
|
+
};
|
|
1917
|
+
var ENHANCED_ACCESSIBILITY = {
|
|
1918
|
+
motion: MINIMAL_MOTION,
|
|
1919
|
+
focus: ENHANCED_FOCUS,
|
|
1920
|
+
contrast: STANDARD_CONTRAST,
|
|
1921
|
+
typography: ENHANCED_TYPOGRAPHY
|
|
1922
|
+
};
|
|
1923
|
+
var MAXIMUM_ACCESSIBILITY = {
|
|
1924
|
+
motion: REDUCED_MOTION,
|
|
1925
|
+
focus: HIGH_VISIBILITY_FOCUS,
|
|
1926
|
+
contrast: HIGH_CONTRAST,
|
|
1927
|
+
typography: MAXIMUM_READABILITY_TYPOGRAPHY
|
|
1928
|
+
};
|
|
1929
|
+
function getLuminance(hex) {
|
|
1930
|
+
const rgb = hex.slice(1).match(/.{2}/g).map((c) => parseInt(c, 16) / 255).map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
1931
|
+
return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2];
|
|
1932
|
+
}
|
|
1933
|
+
function getContrastRatio2(color1, color2) {
|
|
1934
|
+
const l1 = getLuminance(color1);
|
|
1935
|
+
const l2 = getLuminance(color2);
|
|
1936
|
+
const lighter = Math.max(l1, l2);
|
|
1937
|
+
const darker = Math.min(l1, l2);
|
|
1938
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
1939
|
+
}
|
|
1940
|
+
function checkContrast(foreground, background, level = "AA", isLargeText = false) {
|
|
1941
|
+
const ratio = getContrastRatio2(foreground, background);
|
|
1942
|
+
let required;
|
|
1943
|
+
if (level === "AAA") {
|
|
1944
|
+
required = isLargeText ? 4.5 : 7;
|
|
1945
|
+
} else {
|
|
1946
|
+
required = isLargeText ? 3 : 4.5;
|
|
1947
|
+
}
|
|
1948
|
+
return {
|
|
1949
|
+
passes: ratio >= required,
|
|
1950
|
+
ratio: Math.round(ratio * 100) / 100,
|
|
1951
|
+
required
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
function suggestAccessibleColor(color, background, targetRatio = 4.5) {
|
|
1955
|
+
const currentRatio = getContrastRatio2(color, background);
|
|
1956
|
+
if (currentRatio >= targetRatio) {
|
|
1957
|
+
return color;
|
|
1958
|
+
}
|
|
1959
|
+
const r = parseInt(color.slice(1, 3), 16);
|
|
1960
|
+
const g = parseInt(color.slice(3, 5), 16);
|
|
1961
|
+
const b = parseInt(color.slice(5, 7), 16);
|
|
1962
|
+
const bgLuminance = getLuminance(background);
|
|
1963
|
+
const shouldDarken = bgLuminance > 0.5;
|
|
1964
|
+
const factor = shouldDarken ? 0.9 : 1.1;
|
|
1965
|
+
let adjustedR = r, adjustedG = g, adjustedB = b;
|
|
1966
|
+
for (let i = 0; i < 50; i++) {
|
|
1967
|
+
if (shouldDarken) {
|
|
1968
|
+
adjustedR = Math.max(0, Math.floor(adjustedR * factor));
|
|
1969
|
+
adjustedG = Math.max(0, Math.floor(adjustedG * factor));
|
|
1970
|
+
adjustedB = Math.max(0, Math.floor(adjustedB * factor));
|
|
1971
|
+
} else {
|
|
1972
|
+
adjustedR = Math.min(255, Math.floor(adjustedR * factor));
|
|
1973
|
+
adjustedG = Math.min(255, Math.floor(adjustedG * factor));
|
|
1974
|
+
adjustedB = Math.min(255, Math.floor(adjustedB * factor));
|
|
1975
|
+
}
|
|
1976
|
+
const adjusted = `#${adjustedR.toString(16).padStart(2, "0")}${adjustedG.toString(16).padStart(2, "0")}${adjustedB.toString(16).padStart(2, "0")}`;
|
|
1977
|
+
if (getContrastRatio2(adjusted, background) >= targetRatio) {
|
|
1978
|
+
return adjusted;
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
return shouldDarken ? "#000000" : "#ffffff";
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
// src/css-only.ts
|
|
1985
|
+
function tokensToCssVariables(tokens, config = {}) {
|
|
1986
|
+
const prefix = config.prefix || "nice";
|
|
1987
|
+
const flatTokens = flattenTokensToVariables(tokens.tokens, prefix);
|
|
1988
|
+
const rootLines = [":root {", ...flatTokens.map((t) => ` ${t.variable}: ${t.value};`), "}"];
|
|
1989
|
+
const root = rootLines.join("\n");
|
|
1990
|
+
let dark;
|
|
1991
|
+
if (config.includeDarkMode && tokens.themes?.dark) {
|
|
1992
|
+
const darkTokens = flattenTokensToVariables(tokens.themes.dark, prefix);
|
|
1993
|
+
dark = [
|
|
1994
|
+
"@media (prefers-color-scheme: dark) {",
|
|
1995
|
+
" :root {",
|
|
1996
|
+
...darkTokens.map((t) => ` ${t.variable}: ${t.value};`),
|
|
1997
|
+
" }",
|
|
1998
|
+
"}",
|
|
1999
|
+
"",
|
|
2000
|
+
'[data-theme="dark"] {',
|
|
2001
|
+
...darkTokens.map((t) => ` ${t.variable}: ${t.value};`),
|
|
2002
|
+
"}"
|
|
2003
|
+
].join("\n");
|
|
2004
|
+
}
|
|
2005
|
+
let highContrast;
|
|
2006
|
+
if (config.includeHighContrast && tokens.themes?.["high-contrast"]) {
|
|
2007
|
+
const hcTokens = flattenTokensToVariables(tokens.themes["high-contrast"], prefix);
|
|
2008
|
+
highContrast = [
|
|
2009
|
+
"@media (prefers-contrast: more) {",
|
|
2010
|
+
" :root {",
|
|
2011
|
+
...hcTokens.map((t) => ` ${t.variable}: ${t.value};`),
|
|
2012
|
+
" }",
|
|
2013
|
+
"}",
|
|
2014
|
+
"",
|
|
2015
|
+
'[data-theme="high-contrast"] {',
|
|
2016
|
+
...hcTokens.map((t) => ` ${t.variable}: ${t.value};`),
|
|
2017
|
+
"}"
|
|
2018
|
+
].join("\n");
|
|
2019
|
+
}
|
|
2020
|
+
let reducedMotion;
|
|
2021
|
+
if (config.includeReducedMotion) {
|
|
2022
|
+
reducedMotion = generateReducedMotionStyles(prefix);
|
|
2023
|
+
}
|
|
2024
|
+
const utilities = generateUtilityClasses(prefix);
|
|
2025
|
+
const reset = generateMinimalReset(prefix);
|
|
2026
|
+
const sections = [root];
|
|
2027
|
+
if (dark) {
|
|
2028
|
+
sections.push(dark);
|
|
2029
|
+
}
|
|
2030
|
+
if (highContrast) {
|
|
2031
|
+
sections.push(highContrast);
|
|
2032
|
+
}
|
|
2033
|
+
if (reducedMotion) {
|
|
2034
|
+
sections.push(reducedMotion);
|
|
2035
|
+
}
|
|
2036
|
+
if (reset) {
|
|
2037
|
+
sections.push(reset);
|
|
2038
|
+
}
|
|
2039
|
+
if (utilities) {
|
|
2040
|
+
sections.push(utilities);
|
|
2041
|
+
}
|
|
2042
|
+
let combined = sections.join("\n\n");
|
|
2043
|
+
if (config.useLayers) {
|
|
2044
|
+
combined = wrapInLayers(combined);
|
|
2045
|
+
}
|
|
2046
|
+
return {
|
|
2047
|
+
root,
|
|
2048
|
+
dark,
|
|
2049
|
+
highContrast,
|
|
2050
|
+
reducedMotion,
|
|
2051
|
+
utilities,
|
|
2052
|
+
reset,
|
|
2053
|
+
combined
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
function flattenTokensToVariables(input, prefix, path = []) {
|
|
2057
|
+
const result = [];
|
|
2058
|
+
if (Array.isArray(input)) {
|
|
2059
|
+
for (const token of input) {
|
|
2060
|
+
result.push({
|
|
2061
|
+
variable: token.cssVariable || `--${prefix}-${token.path.join("-")}`,
|
|
2062
|
+
value: token.resolvedValue,
|
|
2063
|
+
path: token.path.join(".")
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
return result;
|
|
2067
|
+
}
|
|
2068
|
+
for (const [key, value] of Object.entries(input)) {
|
|
2069
|
+
const currentPath = [...path, key];
|
|
2070
|
+
if (typeof value === "object" && value !== null && "$value" in value) {
|
|
2071
|
+
const token = value;
|
|
2072
|
+
const variable = `--${prefix}-${currentPath.join("-")}`;
|
|
2073
|
+
result.push({
|
|
2074
|
+
variable,
|
|
2075
|
+
value: formatTokenValue(token.$value, token.$type),
|
|
2076
|
+
path: currentPath.join(".")
|
|
2077
|
+
});
|
|
2078
|
+
} else if (typeof value === "object" && value !== null) {
|
|
2079
|
+
result.push(
|
|
2080
|
+
...flattenTokensToVariables(value, prefix, currentPath)
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
return result;
|
|
2085
|
+
}
|
|
2086
|
+
function formatTokenValue(value, type) {
|
|
2087
|
+
if (typeof value === "string") {
|
|
2088
|
+
if (value.startsWith("{") && value.endsWith("}")) {
|
|
2089
|
+
const path = value.slice(1, -1).replace(/\./g, "-");
|
|
2090
|
+
return `var(--nice-${path})`;
|
|
2091
|
+
}
|
|
2092
|
+
return value;
|
|
2093
|
+
}
|
|
2094
|
+
if (typeof value === "number") {
|
|
2095
|
+
if (type === "dimension") {
|
|
2096
|
+
return `${value}px`;
|
|
2097
|
+
}
|
|
2098
|
+
return String(value);
|
|
2099
|
+
}
|
|
2100
|
+
if (Array.isArray(value)) {
|
|
2101
|
+
if (type === "fontFamily") {
|
|
2102
|
+
return value.join(", ");
|
|
2103
|
+
}
|
|
2104
|
+
return value.join(" ");
|
|
2105
|
+
}
|
|
2106
|
+
if (typeof value === "object" && value !== null) {
|
|
2107
|
+
const obj = value;
|
|
2108
|
+
if (type === "shadow") {
|
|
2109
|
+
const offsetX = obj.offsetX || "0";
|
|
2110
|
+
const offsetY = obj.offsetY || "0";
|
|
2111
|
+
const blur = obj.blur || "0";
|
|
2112
|
+
const spread = obj.spread || "0";
|
|
2113
|
+
const color = obj.color || "rgba(0,0,0,0.1)";
|
|
2114
|
+
return `${offsetX} ${offsetY} ${blur} ${spread} ${color}`;
|
|
2115
|
+
}
|
|
2116
|
+
if (type === "typography") {
|
|
2117
|
+
const fontSize = obj.fontSize || "1rem";
|
|
2118
|
+
const fontWeight = obj.fontWeight || "400";
|
|
2119
|
+
const lineHeight = obj.lineHeight || "1.5";
|
|
2120
|
+
const fontFamily = Array.isArray(obj.fontFamily) ? obj.fontFamily.join(", ") : obj.fontFamily || "inherit";
|
|
2121
|
+
return `${fontWeight} ${fontSize}/${lineHeight} ${fontFamily}`;
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
return String(value);
|
|
2125
|
+
}
|
|
2126
|
+
function presetToCss(preset, config = {}) {
|
|
2127
|
+
const prefix = config.prefix || "nice";
|
|
2128
|
+
const lines = [];
|
|
2129
|
+
lines.push(`/* ${preset.displayName} Theme */`);
|
|
2130
|
+
lines.push(`/* Generated by Nice2Dev Design Tokens */`);
|
|
2131
|
+
lines.push("");
|
|
2132
|
+
lines.push(":root {");
|
|
2133
|
+
for (const [colorName, colorValue] of Object.entries(preset.colors)) {
|
|
2134
|
+
if (typeof colorValue === "string") {
|
|
2135
|
+
lines.push(` --${prefix}-color-${colorName}: ${colorValue};`);
|
|
2136
|
+
} else if (typeof colorValue === "object" && colorValue !== null) {
|
|
2137
|
+
const scale = colorValue;
|
|
2138
|
+
for (const [shade, hex] of Object.entries(scale)) {
|
|
2139
|
+
lines.push(` --${prefix}-color-${colorName}-${shade}: ${hex};`);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
if (preset.typography) {
|
|
2144
|
+
lines.push(` --${prefix}-font-body: ${preset.typography.fontFamily};`);
|
|
2145
|
+
if (preset.typography.headingFontFamily) {
|
|
2146
|
+
lines.push(` --${prefix}-font-heading: ${preset.typography.headingFontFamily};`);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
if (preset.borderRadius) {
|
|
2150
|
+
const radii = {
|
|
2151
|
+
none: "0",
|
|
2152
|
+
sm: "0.25rem",
|
|
2153
|
+
md: "0.5rem",
|
|
2154
|
+
lg: "1rem",
|
|
2155
|
+
full: "9999px"
|
|
2156
|
+
};
|
|
2157
|
+
lines.push(` --${prefix}-radius: ${radii[preset.borderRadius]};`);
|
|
2158
|
+
}
|
|
2159
|
+
if (preset.shadows) {
|
|
2160
|
+
const shadowMap = {
|
|
2161
|
+
none: { sm: "none", md: "none", lg: "none" },
|
|
2162
|
+
sm: {
|
|
2163
|
+
sm: "0 1px 2px rgba(0,0,0,0.05)",
|
|
2164
|
+
md: "0 2px 4px rgba(0,0,0,0.05)",
|
|
2165
|
+
lg: "0 4px 8px rgba(0,0,0,0.05)"
|
|
2166
|
+
},
|
|
2167
|
+
md: {
|
|
2168
|
+
sm: "0 1px 3px rgba(0,0,0,0.1)",
|
|
2169
|
+
md: "0 4px 6px rgba(0,0,0,0.1)",
|
|
2170
|
+
lg: "0 10px 15px rgba(0,0,0,0.1)"
|
|
2171
|
+
},
|
|
2172
|
+
lg: {
|
|
2173
|
+
sm: "0 2px 4px rgba(0,0,0,0.15)",
|
|
2174
|
+
md: "0 8px 16px rgba(0,0,0,0.15)",
|
|
2175
|
+
lg: "0 20px 40px rgba(0,0,0,0.15)"
|
|
2176
|
+
}
|
|
2177
|
+
};
|
|
2178
|
+
const shadows = shadowMap[preset.shadows];
|
|
2179
|
+
lines.push(` --${prefix}-shadow-sm: ${shadows.sm};`);
|
|
2180
|
+
lines.push(` --${prefix}-shadow-md: ${shadows.md};`);
|
|
2181
|
+
lines.push(` --${prefix}-shadow-lg: ${shadows.lg};`);
|
|
2182
|
+
}
|
|
2183
|
+
lines.push("}");
|
|
2184
|
+
return lines.join("\n");
|
|
2185
|
+
}
|
|
2186
|
+
function generateUtilityClasses(prefix) {
|
|
2187
|
+
return `
|
|
2188
|
+
/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
2189
|
+
UTILITY CLASSES
|
|
2190
|
+
Generated CSS utilities using CSS variables
|
|
2191
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
2192
|
+
|
|
2193
|
+
/* Colors */
|
|
2194
|
+
.text-primary { color: var(--${prefix}-color-primary-500); }
|
|
2195
|
+
.text-secondary { color: var(--${prefix}-color-secondary-500); }
|
|
2196
|
+
.text-accent { color: var(--${prefix}-color-accent-500); }
|
|
2197
|
+
.text-success { color: var(--${prefix}-color-success); }
|
|
2198
|
+
.text-warning { color: var(--${prefix}-color-warning); }
|
|
2199
|
+
.text-error { color: var(--${prefix}-color-error); }
|
|
2200
|
+
.text-info { color: var(--${prefix}-color-info); }
|
|
2201
|
+
|
|
2202
|
+
.bg-primary { background-color: var(--${prefix}-color-primary-500); }
|
|
2203
|
+
.bg-secondary { background-color: var(--${prefix}-color-secondary-500); }
|
|
2204
|
+
.bg-accent { background-color: var(--${prefix}-color-accent-500); }
|
|
2205
|
+
.bg-success { background-color: var(--${prefix}-color-success); }
|
|
2206
|
+
.bg-warning { background-color: var(--${prefix}-color-warning); }
|
|
2207
|
+
.bg-error { background-color: var(--${prefix}-color-error); }
|
|
2208
|
+
.bg-info { background-color: var(--${prefix}-color-info); }
|
|
2209
|
+
|
|
2210
|
+
/* Border */
|
|
2211
|
+
.border-primary { border-color: var(--${prefix}-color-primary-500); }
|
|
2212
|
+
.rounded { border-radius: var(--${prefix}-radius); }
|
|
2213
|
+
.rounded-sm { border-radius: calc(var(--${prefix}-radius) * 0.5); }
|
|
2214
|
+
.rounded-lg { border-radius: calc(var(--${prefix}-radius) * 2); }
|
|
2215
|
+
.rounded-full { border-radius: 9999px; }
|
|
2216
|
+
|
|
2217
|
+
/* Shadows */
|
|
2218
|
+
.shadow-sm { box-shadow: var(--${prefix}-shadow-sm); }
|
|
2219
|
+
.shadow-md { box-shadow: var(--${prefix}-shadow-md); }
|
|
2220
|
+
.shadow-lg { box-shadow: var(--${prefix}-shadow-lg); }
|
|
2221
|
+
.shadow-none { box-shadow: none; }
|
|
2222
|
+
|
|
2223
|
+
/* Typography */
|
|
2224
|
+
.font-body { font-family: var(--${prefix}-font-body); }
|
|
2225
|
+
.font-heading { font-family: var(--${prefix}-font-heading, var(--${prefix}-font-body)); }
|
|
2226
|
+
|
|
2227
|
+
/* Focus */
|
|
2228
|
+
.focus-ring:focus-visible {
|
|
2229
|
+
outline: 2px solid var(--${prefix}-color-primary-500);
|
|
2230
|
+
outline-offset: 2px;
|
|
2231
|
+
}
|
|
2232
|
+
`.trim();
|
|
2233
|
+
}
|
|
2234
|
+
function generateMinimalReset(prefix) {
|
|
2235
|
+
return `
|
|
2236
|
+
/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
2237
|
+
MINIMAL RESET
|
|
2238
|
+
Component-ready CSS reset using design tokens
|
|
2239
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
2240
|
+
|
|
2241
|
+
*, *::before, *::after {
|
|
2242
|
+
box-sizing: border-box;
|
|
2243
|
+
margin: 0;
|
|
2244
|
+
padding: 0;
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
html {
|
|
2248
|
+
font-family: var(--${prefix}-font-body, system-ui, sans-serif);
|
|
2249
|
+
line-height: 1.5;
|
|
2250
|
+
-webkit-text-size-adjust: 100%;
|
|
2251
|
+
-webkit-font-smoothing: antialiased;
|
|
2252
|
+
-moz-osx-font-smoothing: grayscale;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
body {
|
|
2256
|
+
min-height: 100vh;
|
|
2257
|
+
color: var(--${prefix}-color-neutral-900);
|
|
2258
|
+
background-color: var(--${prefix}-color-neutral-50);
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
h1, h2, h3, h4, h5, h6 {
|
|
2262
|
+
font-family: var(--${prefix}-font-heading, var(--${prefix}-font-body));
|
|
2263
|
+
font-weight: 600;
|
|
2264
|
+
line-height: 1.25;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
a {
|
|
2268
|
+
color: var(--${prefix}-color-primary-500);
|
|
2269
|
+
text-decoration: none;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
a:hover {
|
|
2273
|
+
color: var(--${prefix}-color-primary-600);
|
|
2274
|
+
text-decoration: underline;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
button, input, select, textarea {
|
|
2278
|
+
font-family: inherit;
|
|
2279
|
+
font-size: inherit;
|
|
2280
|
+
line-height: inherit;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
button {
|
|
2284
|
+
cursor: pointer;
|
|
2285
|
+
border: none;
|
|
2286
|
+
background: transparent;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
img, svg, video {
|
|
2290
|
+
display: block;
|
|
2291
|
+
max-width: 100%;
|
|
2292
|
+
height: auto;
|
|
2293
|
+
}
|
|
2294
|
+
`.trim();
|
|
2295
|
+
}
|
|
2296
|
+
function generateReducedMotionStyles(prefix) {
|
|
2297
|
+
return `
|
|
2298
|
+
/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
2299
|
+
REDUCED MOTION
|
|
2300
|
+
Respect user preferences for reduced motion
|
|
2301
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
2302
|
+
|
|
2303
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2304
|
+
*, *::before, *::after {
|
|
2305
|
+
animation-duration: 0.01ms !important;
|
|
2306
|
+
animation-iteration-count: 1 !important;
|
|
2307
|
+
transition-duration: 0.01ms !important;
|
|
2308
|
+
scroll-behavior: auto !important;
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
/* Motion-safe utilities */
|
|
2313
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
2314
|
+
.animate-fade-in {
|
|
2315
|
+
animation: ${prefix}-fade-in 200ms ease-out;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
.animate-slide-up {
|
|
2319
|
+
animation: ${prefix}-slide-up 200ms ease-out;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
.animate-scale-in {
|
|
2323
|
+
animation: ${prefix}-scale-in 200ms ease-out;
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
@keyframes ${prefix}-fade-in {
|
|
2328
|
+
from { opacity: 0; }
|
|
2329
|
+
to { opacity: 1; }
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
@keyframes ${prefix}-slide-up {
|
|
2333
|
+
from { opacity: 0; transform: translateY(10px); }
|
|
2334
|
+
to { opacity: 1; transform: translateY(0); }
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
@keyframes ${prefix}-scale-in {
|
|
2338
|
+
from { opacity: 0; transform: scale(0.95); }
|
|
2339
|
+
to { opacity: 1; transform: scale(1); }
|
|
2340
|
+
}
|
|
2341
|
+
`.trim();
|
|
2342
|
+
}
|
|
2343
|
+
function wrapInLayers(css) {
|
|
2344
|
+
return `
|
|
2345
|
+
/* Define layer order */
|
|
2346
|
+
@layer reset, tokens, utilities, components;
|
|
2347
|
+
|
|
2348
|
+
@layer tokens {
|
|
2349
|
+
${css.split("\n").map((l) => ` ${l}`).join("\n")}
|
|
2350
|
+
}
|
|
2351
|
+
`.trim();
|
|
2352
|
+
}
|
|
2353
|
+
function generateComponentStyles(prefix = "nice") {
|
|
2354
|
+
return `
|
|
2355
|
+
/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
2356
|
+
CSS-ONLY COMPONENT STYLES
|
|
2357
|
+
No CSS-in-JS required \u2014 pure CSS variables approach
|
|
2358
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
2359
|
+
|
|
2360
|
+
/* Button */
|
|
2361
|
+
.${prefix}-button {
|
|
2362
|
+
display: inline-flex;
|
|
2363
|
+
align-items: center;
|
|
2364
|
+
justify-content: center;
|
|
2365
|
+
gap: 0.5rem;
|
|
2366
|
+
padding: 0.5rem 1rem;
|
|
2367
|
+
font-weight: 500;
|
|
2368
|
+
border-radius: var(--${prefix}-radius, 0.5rem);
|
|
2369
|
+
transition: all 150ms ease;
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
.${prefix}-button--primary {
|
|
2373
|
+
background-color: var(--${prefix}-color-primary-500);
|
|
2374
|
+
color: white;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
.${prefix}-button--primary:hover {
|
|
2378
|
+
background-color: var(--${prefix}-color-primary-600);
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
.${prefix}-button--secondary {
|
|
2382
|
+
background-color: var(--${prefix}-color-neutral-100);
|
|
2383
|
+
color: var(--${prefix}-color-neutral-900);
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
.${prefix}-button--secondary:hover {
|
|
2387
|
+
background-color: var(--${prefix}-color-neutral-200);
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
.${prefix}-button--outline {
|
|
2391
|
+
border: 1px solid var(--${prefix}-color-primary-500);
|
|
2392
|
+
color: var(--${prefix}-color-primary-500);
|
|
2393
|
+
background: transparent;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
.${prefix}-button--outline:hover {
|
|
2397
|
+
background-color: var(--${prefix}-color-primary-50);
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
.${prefix}-button:disabled {
|
|
2401
|
+
opacity: 0.5;
|
|
2402
|
+
cursor: not-allowed;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
/* Input */
|
|
2406
|
+
.${prefix}-input {
|
|
2407
|
+
width: 100%;
|
|
2408
|
+
padding: 0.5rem 0.75rem;
|
|
2409
|
+
border: 1px solid var(--${prefix}-color-neutral-300);
|
|
2410
|
+
border-radius: var(--${prefix}-radius, 0.5rem);
|
|
2411
|
+
background-color: var(--${prefix}-color-neutral-50);
|
|
2412
|
+
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
.${prefix}-input:focus {
|
|
2416
|
+
outline: none;
|
|
2417
|
+
border-color: var(--${prefix}-color-primary-500);
|
|
2418
|
+
box-shadow: 0 0 0 3px var(--${prefix}-color-primary-100);
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
.${prefix}-input:disabled {
|
|
2422
|
+
opacity: 0.5;
|
|
2423
|
+
cursor: not-allowed;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
.${prefix}-input--error {
|
|
2427
|
+
border-color: var(--${prefix}-color-error);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/* Card */
|
|
2431
|
+
.${prefix}-card {
|
|
2432
|
+
background-color: var(--${prefix}-color-neutral-50);
|
|
2433
|
+
border: 1px solid var(--${prefix}-color-neutral-200);
|
|
2434
|
+
border-radius: var(--${prefix}-radius, 0.5rem);
|
|
2435
|
+
box-shadow: var(--${prefix}-shadow-sm);
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
.${prefix}-card__header {
|
|
2439
|
+
padding: 1rem 1.5rem;
|
|
2440
|
+
border-bottom: 1px solid var(--${prefix}-color-neutral-200);
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
.${prefix}-card__body {
|
|
2444
|
+
padding: 1.5rem;
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
.${prefix}-card__footer {
|
|
2448
|
+
padding: 1rem 1.5rem;
|
|
2449
|
+
border-top: 1px solid var(--${prefix}-color-neutral-200);
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
/* Badge */
|
|
2453
|
+
.${prefix}-badge {
|
|
2454
|
+
display: inline-flex;
|
|
2455
|
+
align-items: center;
|
|
2456
|
+
padding: 0.25rem 0.5rem;
|
|
2457
|
+
font-size: 0.75rem;
|
|
2458
|
+
font-weight: 500;
|
|
2459
|
+
border-radius: 9999px;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
.${prefix}-badge--primary {
|
|
2463
|
+
background-color: var(--${prefix}-color-primary-100);
|
|
2464
|
+
color: var(--${prefix}-color-primary-700);
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
.${prefix}-badge--success {
|
|
2468
|
+
background-color: #dcfce7;
|
|
2469
|
+
color: #166534;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
.${prefix}-badge--warning {
|
|
2473
|
+
background-color: #fef3c7;
|
|
2474
|
+
color: #92400e;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
.${prefix}-badge--error {
|
|
2478
|
+
background-color: #fee2e2;
|
|
2479
|
+
color: #991b1b;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
/* Alert */
|
|
2483
|
+
.${prefix}-alert {
|
|
2484
|
+
display: flex;
|
|
2485
|
+
gap: 0.75rem;
|
|
2486
|
+
padding: 1rem;
|
|
2487
|
+
border-radius: var(--${prefix}-radius, 0.5rem);
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
.${prefix}-alert--info {
|
|
2491
|
+
background-color: #eff6ff;
|
|
2492
|
+
border: 1px solid #bfdbfe;
|
|
2493
|
+
color: #1e40af;
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
.${prefix}-alert--success {
|
|
2497
|
+
background-color: #f0fdf4;
|
|
2498
|
+
border: 1px solid #bbf7d0;
|
|
2499
|
+
color: #166534;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
.${prefix}-alert--warning {
|
|
2503
|
+
background-color: #fffbeb;
|
|
2504
|
+
border: 1px solid #fde68a;
|
|
2505
|
+
color: #92400e;
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
.${prefix}-alert--error {
|
|
2509
|
+
background-color: #fef2f2;
|
|
2510
|
+
border: 1px solid #fecaca;
|
|
2511
|
+
color: #991b1b;
|
|
2512
|
+
}
|
|
2513
|
+
`.trim();
|
|
2514
|
+
}
|
|
2515
|
+
function generateCompleteStylesheet(preset, config = {}) {
|
|
2516
|
+
const prefix = config.prefix || "nice";
|
|
2517
|
+
const sections = [];
|
|
2518
|
+
sections.push(`/**
|
|
2519
|
+
* ${preset.displayName} Theme Stylesheet
|
|
2520
|
+
* Generated by Nice2Dev Design Tokens
|
|
2521
|
+
* CSS-only approach \u2014 no CSS-in-JS runtime
|
|
2522
|
+
*/`);
|
|
2523
|
+
if (config.useLayers) {
|
|
2524
|
+
sections.push("@layer reset, tokens, utilities, components;");
|
|
2525
|
+
}
|
|
2526
|
+
sections.push(presetToCss(preset, config));
|
|
2527
|
+
sections.push(generateMinimalReset(prefix));
|
|
2528
|
+
sections.push(generateUtilityClasses(prefix));
|
|
2529
|
+
sections.push(generateComponentStyles(prefix));
|
|
2530
|
+
if (config.includeReducedMotion) {
|
|
2531
|
+
sections.push(generateReducedMotionStyles(prefix));
|
|
2532
|
+
}
|
|
2533
|
+
return sections.join("\n\n");
|
|
2534
|
+
}
|
|
2535
|
+
export {
|
|
2536
|
+
ENHANCED_ACCESSIBILITY,
|
|
2537
|
+
ENHANCED_FOCUS,
|
|
2538
|
+
ENHANCED_TYPOGRAPHY,
|
|
2539
|
+
HIGH_CONTRAST,
|
|
2540
|
+
HIGH_CONTRAST_DARK,
|
|
2541
|
+
HIGH_VISIBILITY_FOCUS,
|
|
2542
|
+
MAXIMUM_ACCESSIBILITY,
|
|
2543
|
+
MAXIMUM_READABILITY_TYPOGRAPHY,
|
|
2544
|
+
MINIMAL_MOTION,
|
|
2545
|
+
PRESETS,
|
|
2546
|
+
REDUCED_MOTION,
|
|
2547
|
+
STANDARD_ACCESSIBILITY,
|
|
2548
|
+
STANDARD_CONTRAST,
|
|
2549
|
+
STANDARD_FOCUS,
|
|
2550
|
+
STANDARD_MOTION,
|
|
2551
|
+
STANDARD_TYPOGRAPHY,
|
|
2552
|
+
TokenGenerator,
|
|
2553
|
+
analyzeColor,
|
|
2554
|
+
buildTokenObject,
|
|
2555
|
+
checkCircularReferences,
|
|
2556
|
+
checkContrast,
|
|
2557
|
+
createGenerator,
|
|
2558
|
+
createTheme,
|
|
2559
|
+
createTokenCollection,
|
|
2560
|
+
cubicBezierToCss,
|
|
2561
|
+
darkenColor,
|
|
2562
|
+
defaultOptions,
|
|
2563
|
+
defaultThemes,
|
|
2564
|
+
durationToMs,
|
|
2565
|
+
extractReferencePath,
|
|
2566
|
+
filterTokensByPath,
|
|
2567
|
+
filterTokensByType,
|
|
2568
|
+
findReferences,
|
|
2569
|
+
flattenTokens,
|
|
2570
|
+
fontWeightToNumber,
|
|
2571
|
+
generateAccessibilityCss,
|
|
2572
|
+
generateBrandKit,
|
|
2573
|
+
generateColorScale2 as generateColorScale,
|
|
2574
|
+
generateColorScale as generateColorScaleAsync,
|
|
2575
|
+
generateCompleteStylesheet,
|
|
2576
|
+
generateComponentStyles,
|
|
2577
|
+
generateDarkModeTokens,
|
|
2578
|
+
generateFocusCss,
|
|
2579
|
+
generateHighContrastCss,
|
|
2580
|
+
generateHighContrastTokens,
|
|
2581
|
+
generateReactThemeContext,
|
|
2582
|
+
generateReducedMotionCss,
|
|
2583
|
+
generateThemeSwitcher,
|
|
2584
|
+
generateThemesCss,
|
|
2585
|
+
generateTokenTypes,
|
|
2586
|
+
generateTokens,
|
|
2587
|
+
getAccessibleTextColor,
|
|
2588
|
+
getAllCategories,
|
|
2589
|
+
getCategories,
|
|
2590
|
+
getContrastRatio2 as getContrastRatio,
|
|
2591
|
+
getContrastRatio as getContrastRatioAsync,
|
|
2592
|
+
getDependencyGraph,
|
|
2593
|
+
getPresetByName,
|
|
2594
|
+
getPresetsByCategory,
|
|
2595
|
+
getTokenByPath,
|
|
2596
|
+
hexToHsl,
|
|
2597
|
+
hexToOklch,
|
|
2598
|
+
hexToRgb,
|
|
2599
|
+
industryBrandKit,
|
|
2600
|
+
isDesignToken,
|
|
2601
|
+
isReference,
|
|
2602
|
+
isTokenGroup,
|
|
2603
|
+
lightenColor,
|
|
2604
|
+
mergeTokenFiles,
|
|
2605
|
+
parseTokenDirectory,
|
|
2606
|
+
parseTokenFile,
|
|
2607
|
+
parseTokenFiles,
|
|
2608
|
+
pathToCssVariable,
|
|
2609
|
+
pathToString,
|
|
2610
|
+
presetToCss,
|
|
2611
|
+
presetToCssVariables,
|
|
2612
|
+
presetToTokens,
|
|
2613
|
+
pxToEm,
|
|
2614
|
+
pxToRem,
|
|
2615
|
+
quickBrandKit,
|
|
2616
|
+
remToPx,
|
|
2617
|
+
resolveToVariable,
|
|
2618
|
+
resolveTokenValue,
|
|
2619
|
+
resolveTokens,
|
|
2620
|
+
sortTokensByDependencies,
|
|
2621
|
+
suggestAccessibleColor,
|
|
2622
|
+
tokensToCssVariables,
|
|
2623
|
+
transformToCss,
|
|
2624
|
+
transformToJs,
|
|
2625
|
+
transformToScss,
|
|
2626
|
+
transformToTailwind,
|
|
2627
|
+
transformToTs
|
|
2628
|
+
};
|