xertica-ui 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.ts +38 -7
- package/contexts/BrandColorsContext.tsx +55 -389
- package/contexts/theme-data.ts +340 -0
- package/dist/cli.js +301 -2
- package/package.json +2 -2
package/bin/cli.ts
CHANGED
|
@@ -7,6 +7,7 @@ import fs from 'fs-extra';
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import { execa } from 'execa';
|
|
10
|
+
import { colorThemes } from '../contexts/theme-data';
|
|
10
11
|
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
13
|
const __dirname = path.dirname(__filename);
|
|
@@ -34,7 +35,7 @@ program
|
|
|
34
35
|
const files = await fs.readdir(uiComponentsDir);
|
|
35
36
|
const components = files
|
|
36
37
|
.filter(f => f.endsWith('.tsx') && !f.startsWith('index'))
|
|
37
|
-
.map(f => ({ title: f.replace('.tsx', ''), value: f }));
|
|
38
|
+
.map(f => ({ title: f.replace('.tsx', ''), value: f, selected: true }));
|
|
38
39
|
|
|
39
40
|
componentChoices = [
|
|
40
41
|
{ title: 'All Components', value: 'all', selected: true },
|
|
@@ -42,6 +43,8 @@ program
|
|
|
42
43
|
];
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
|
|
47
|
+
|
|
45
48
|
console.log(chalk.blue('🚀 Welcome to Xertica UI CLI!'));
|
|
46
49
|
|
|
47
50
|
const response = await prompts([
|
|
@@ -49,7 +52,12 @@ program
|
|
|
49
52
|
type: 'multiselect',
|
|
50
53
|
name: 'components',
|
|
51
54
|
message: 'Which components would you like to include?',
|
|
52
|
-
choices: componentChoices
|
|
55
|
+
choices: componentChoices.length > 1 ? componentChoices : [
|
|
56
|
+
{ title: 'All Components', value: 'all', selected: true },
|
|
57
|
+
// Fetch components logic was above, I'll rely on existing code for that part
|
|
58
|
+
// and just insert my code around existing blocks in separate steps if needed.
|
|
59
|
+
// But replace_file_content requires me to match content.
|
|
60
|
+
],
|
|
53
61
|
hint: '- Space to select. Return to submit',
|
|
54
62
|
min: 1
|
|
55
63
|
},
|
|
@@ -63,6 +71,17 @@ program
|
|
|
63
71
|
{ title: 'Template Page', value: 'template', selected: true },
|
|
64
72
|
]
|
|
65
73
|
},
|
|
74
|
+
{
|
|
75
|
+
type: 'select',
|
|
76
|
+
name: 'theme',
|
|
77
|
+
message: 'Select the default color theme for your project:',
|
|
78
|
+
choices: colorThemes.map(t => ({
|
|
79
|
+
title: t.name,
|
|
80
|
+
description: t.description,
|
|
81
|
+
value: t.id
|
|
82
|
+
})),
|
|
83
|
+
initial: 0
|
|
84
|
+
},
|
|
66
85
|
{
|
|
67
86
|
type: 'confirm',
|
|
68
87
|
name: 'install',
|
|
@@ -143,11 +162,7 @@ export default function App() {
|
|
|
143
162
|
if (basename === 'node_modules') return false;
|
|
144
163
|
|
|
145
164
|
// Component filtering
|
|
146
|
-
|
|
147
|
-
// Or just check if basename is in the list.
|
|
148
|
-
// Warning: 'button.tsx' might be in other places? Unlikely in flat structure components/ui
|
|
149
|
-
// Ideally we check if it is inside components/ui
|
|
150
|
-
const isUI = src.includes(path.join('components', 'ui')); // Simple check
|
|
165
|
+
const isUI = src.includes(path.join('components', 'ui'));
|
|
151
166
|
|
|
152
167
|
if (isUI && folder === 'components') {
|
|
153
168
|
if (basename === 'index.ts') return true;
|
|
@@ -177,6 +192,22 @@ export default function App() {
|
|
|
177
192
|
}
|
|
178
193
|
}
|
|
179
194
|
|
|
195
|
+
// --- Apply Selected Theme ---
|
|
196
|
+
if (response.theme) {
|
|
197
|
+
const contextPath = path.join(targetDir, 'contexts', 'BrandColorsContext.tsx');
|
|
198
|
+
if (await fs.pathExists(contextPath)) {
|
|
199
|
+
let content = await fs.readFile(contextPath, 'utf8');
|
|
200
|
+
// Replace default theme
|
|
201
|
+
// Need to match the line: return saved || 'xertica-original';
|
|
202
|
+
// We can use regex to be safe
|
|
203
|
+
content = content.replace(
|
|
204
|
+
/return saved \|\| 'xertica-original';/,
|
|
205
|
+
`return saved || '${response.theme}';`
|
|
206
|
+
);
|
|
207
|
+
await fs.writeFile(contextPath, content);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
180
211
|
spinner.succeed('Project initialized successfully!');
|
|
181
212
|
|
|
182
213
|
if (response.install) {
|
|
@@ -1,47 +1,11 @@
|
|
|
1
1
|
import React, { createContext, useContext, useState, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// Dark Mode Overrides
|
|
10
|
-
primaryDarkMode: string;
|
|
11
|
-
primaryForegroundDark: string;
|
|
12
|
-
|
|
13
|
-
// Sidebar Colors
|
|
14
|
-
sidebarLight: string;
|
|
15
|
-
sidebarDark: string;
|
|
16
|
-
|
|
17
|
-
// Gradients
|
|
18
|
-
gradientStart: string;
|
|
19
|
-
gradientEnd: string;
|
|
20
|
-
gradientStartDark: string;
|
|
21
|
-
gradientEndDark: string;
|
|
22
|
-
|
|
23
|
-
// Chart Colors (Light Mode) - Dark mode will be calculated or fixed
|
|
24
|
-
chart1: string;
|
|
25
|
-
chart2: string;
|
|
26
|
-
chart3: string;
|
|
27
|
-
chart4: string;
|
|
28
|
-
chart5: string;
|
|
29
|
-
|
|
30
|
-
// Optional: Radius override per theme
|
|
31
|
-
radius?: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface ColorTheme {
|
|
35
|
-
id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
description: string;
|
|
38
|
-
colors: BrandColors;
|
|
39
|
-
preview: {
|
|
40
|
-
primary: string;
|
|
41
|
-
secondary: string;
|
|
42
|
-
accent: string;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
3
|
+
import {
|
|
4
|
+
BrandColors,
|
|
5
|
+
ColorTheme,
|
|
6
|
+
PALETTE,
|
|
7
|
+
colorThemes,
|
|
8
|
+
} from './theme-data';
|
|
45
9
|
|
|
46
10
|
interface BrandColorsContextType {
|
|
47
11
|
colors: BrandColors;
|
|
@@ -52,304 +16,6 @@ interface BrandColorsContextType {
|
|
|
52
16
|
setRadius: (radius: number) => void;
|
|
53
17
|
}
|
|
54
18
|
|
|
55
|
-
// Shadcn Standard Palette Values (approximate hex for compatibility)
|
|
56
|
-
const PALETTE = {
|
|
57
|
-
zinc: { 900: '#18181b', 50: '#fafafa' },
|
|
58
|
-
slate: { 900: '#0f172a', 50: '#f8fafc' },
|
|
59
|
-
stone: { 900: '#1c1917', 50: '#fafaf9' },
|
|
60
|
-
gray: { 900: '#111827', 50: '#f9fafb' },
|
|
61
|
-
neutral: { 900: '#171717', 50: '#fafafa' },
|
|
62
|
-
red: { 600: '#dc2626', 500: '#ef4444' },
|
|
63
|
-
rose: { 600: '#e11d48', 500: '#f43f5e' },
|
|
64
|
-
orange: { 600: '#ea580c', 500: '#f97316' },
|
|
65
|
-
green: { 600: '#16a34a', 500: '#22c55e' },
|
|
66
|
-
blue: { 600: '#2563eb', 500: '#3b82f6' },
|
|
67
|
-
yellow: { 600: '#ca8a04', 500: '#eab308' },
|
|
68
|
-
violet: { 600: '#7c3aed', 500: '#8b5cf6' },
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const colorThemes: ColorTheme[] = [
|
|
72
|
-
{
|
|
73
|
-
id: 'xertica-original',
|
|
74
|
-
name: 'Xertica Original',
|
|
75
|
-
description: 'A identidade visual clássica da Xertica com o gradiente original',
|
|
76
|
-
colors: {
|
|
77
|
-
primary: '#2C275B',
|
|
78
|
-
primaryForeground: '#FFFFFF',
|
|
79
|
-
primaryLight: '#5B568F',
|
|
80
|
-
primaryDarkMode: '#72CDFD',
|
|
81
|
-
primaryForegroundDark: '#09090B',
|
|
82
|
-
|
|
83
|
-
sidebarLight: '#2C275B', // Primary Color
|
|
84
|
-
sidebarDark: '#1a1928', // Original Dark BG
|
|
85
|
-
|
|
86
|
-
gradientStart: '#FDB0F2',
|
|
87
|
-
gradientEnd: '#72CDFD',
|
|
88
|
-
gradientStartDark: '#7B4A7A',
|
|
89
|
-
gradientEndDark: '#3A5C7D',
|
|
90
|
-
|
|
91
|
-
chart1: '#2C275B',
|
|
92
|
-
chart2: '#FDB0F2',
|
|
93
|
-
chart3: '#72CDFD',
|
|
94
|
-
chart4: '#5B568F',
|
|
95
|
-
chart5: '#4F46E5',
|
|
96
|
-
},
|
|
97
|
-
preview: {
|
|
98
|
-
primary: '#2C275B',
|
|
99
|
-
secondary: '#FDB0F2',
|
|
100
|
-
accent: '#72CDFD',
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: 'zinc',
|
|
105
|
-
name: 'Zinc',
|
|
106
|
-
description: 'Minimalista, sério e elegante (Escala de Cinza)',
|
|
107
|
-
colors: {
|
|
108
|
-
primary: '#18181B',
|
|
109
|
-
primaryForeground: '#FAFAFA',
|
|
110
|
-
primaryLight: '#E4E4E7',
|
|
111
|
-
primaryDarkMode: '#FAFAFA',
|
|
112
|
-
primaryForegroundDark: '#18181B',
|
|
113
|
-
|
|
114
|
-
sidebarLight: '#18181B', // Primary Color
|
|
115
|
-
sidebarDark: '#09090B',
|
|
116
|
-
|
|
117
|
-
gradientStart: '#52525B',
|
|
118
|
-
gradientEnd: '#D4D4D8',
|
|
119
|
-
gradientStartDark: '#27272A',
|
|
120
|
-
gradientEndDark: '#52525B',
|
|
121
|
-
|
|
122
|
-
chart1: '#18181B',
|
|
123
|
-
chart2: '#52525B',
|
|
124
|
-
chart3: '#A1A1AA',
|
|
125
|
-
chart4: '#D4D4D8',
|
|
126
|
-
chart5: '#E4E4E7',
|
|
127
|
-
},
|
|
128
|
-
preview: {
|
|
129
|
-
primary: '#18181B',
|
|
130
|
-
secondary: '#52525B',
|
|
131
|
-
accent: '#E4E4E7',
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
id: 'slate',
|
|
136
|
-
name: 'Slate',
|
|
137
|
-
description: 'Profissional com tons de azul acinzentado',
|
|
138
|
-
colors: {
|
|
139
|
-
primary: '#0F172A',
|
|
140
|
-
primaryForeground: '#F8FAFC',
|
|
141
|
-
primaryLight: '#CBD5E1',
|
|
142
|
-
primaryDarkMode: '#F8FAFC',
|
|
143
|
-
primaryForegroundDark: '#0F172A',
|
|
144
|
-
|
|
145
|
-
sidebarLight: '#0F172A', // Primary Color
|
|
146
|
-
sidebarDark: '#020617',
|
|
147
|
-
|
|
148
|
-
gradientStart: '#475569',
|
|
149
|
-
gradientEnd: '#94A3B8',
|
|
150
|
-
gradientStartDark: '#1E293B',
|
|
151
|
-
gradientEndDark: '#475569',
|
|
152
|
-
|
|
153
|
-
chart1: '#0F172A',
|
|
154
|
-
chart2: '#475569',
|
|
155
|
-
chart3: '#94A3B8',
|
|
156
|
-
chart4: '#CBD5E1',
|
|
157
|
-
chart5: '#E2E8F0',
|
|
158
|
-
},
|
|
159
|
-
preview: {
|
|
160
|
-
primary: '#0F172A',
|
|
161
|
-
secondary: '#475569',
|
|
162
|
-
accent: '#94A3B8',
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: 'blue',
|
|
167
|
-
name: 'Blue',
|
|
168
|
-
description: 'Confiável e seguro, padrão corporativo',
|
|
169
|
-
colors: {
|
|
170
|
-
primary: '#2563EB',
|
|
171
|
-
primaryForeground: '#FFFFFF',
|
|
172
|
-
primaryLight: '#DBEAFE',
|
|
173
|
-
primaryDarkMode: '#3B82F6',
|
|
174
|
-
primaryForegroundDark: '#FFFFFF',
|
|
175
|
-
|
|
176
|
-
sidebarLight: '#1E3A8A', // Blue 900 (High Contrast Sidebar)
|
|
177
|
-
sidebarDark: '#172554',
|
|
178
|
-
|
|
179
|
-
gradientStart: '#2563EB',
|
|
180
|
-
gradientEnd: '#60A5FA',
|
|
181
|
-
gradientStartDark: '#1D4ED8',
|
|
182
|
-
gradientEndDark: '#2563EB',
|
|
183
|
-
|
|
184
|
-
chart1: '#2563EB',
|
|
185
|
-
chart2: '#3B82F6',
|
|
186
|
-
chart3: '#60A5FA',
|
|
187
|
-
chart4: '#93C5FD',
|
|
188
|
-
chart5: '#BFDBFE',
|
|
189
|
-
},
|
|
190
|
-
preview: {
|
|
191
|
-
primary: '#2563EB',
|
|
192
|
-
secondary: '#60A5FA',
|
|
193
|
-
accent: '#DBEAFE',
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
id: 'violet',
|
|
198
|
-
name: 'Violet',
|
|
199
|
-
description: 'Criativo e vibrante',
|
|
200
|
-
colors: {
|
|
201
|
-
primary: '#7C3AED',
|
|
202
|
-
primaryForeground: '#FFFFFF',
|
|
203
|
-
primaryLight: '#EDE9FE',
|
|
204
|
-
primaryDarkMode: '#8B5CF6',
|
|
205
|
-
primaryForegroundDark: '#FFFFFF',
|
|
206
|
-
|
|
207
|
-
sidebarLight: '#4C1D95', // Violet 900 (High Contrast Sidebar)
|
|
208
|
-
sidebarDark: '#2E1065',
|
|
209
|
-
|
|
210
|
-
gradientStart: '#7C3AED',
|
|
211
|
-
gradientEnd: '#A78BFA',
|
|
212
|
-
gradientStartDark: '#5B21B6',
|
|
213
|
-
gradientEndDark: '#7C3AED',
|
|
214
|
-
|
|
215
|
-
chart1: '#7C3AED',
|
|
216
|
-
chart2: '#8B5CF6',
|
|
217
|
-
chart3: '#A78BFA',
|
|
218
|
-
chart4: '#C4B5FD',
|
|
219
|
-
chart5: '#DDD6FE',
|
|
220
|
-
},
|
|
221
|
-
preview: {
|
|
222
|
-
primary: '#7C3AED',
|
|
223
|
-
secondary: '#A78BFA',
|
|
224
|
-
accent: '#EDE9FE',
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
id: 'rose',
|
|
229
|
-
name: 'Rose',
|
|
230
|
-
description: 'Elegante e suave',
|
|
231
|
-
colors: {
|
|
232
|
-
primary: '#BE123C', // Rose 700 (Better text contrast for Primary)
|
|
233
|
-
primaryForeground: '#FFFFFF',
|
|
234
|
-
primaryLight: '#FFE4E6',
|
|
235
|
-
primaryDarkMode: '#F43F5E',
|
|
236
|
-
primaryForegroundDark: '#FFFFFF',
|
|
237
|
-
|
|
238
|
-
sidebarLight: '#881337', // Rose 900 (High Contrast Sidebar)
|
|
239
|
-
sidebarDark: '#881337',
|
|
240
|
-
|
|
241
|
-
gradientStart: '#E11D48',
|
|
242
|
-
gradientEnd: '#FB7185',
|
|
243
|
-
gradientStartDark: '#9F1239',
|
|
244
|
-
gradientEndDark: '#E11D48',
|
|
245
|
-
|
|
246
|
-
chart1: '#E11D48',
|
|
247
|
-
chart2: '#F43F5E',
|
|
248
|
-
chart3: '#FB7185',
|
|
249
|
-
chart4: '#FDA4AF',
|
|
250
|
-
chart5: '#FECDD3',
|
|
251
|
-
},
|
|
252
|
-
preview: {
|
|
253
|
-
primary: '#BE123C',
|
|
254
|
-
secondary: '#FB7185',
|
|
255
|
-
accent: '#FFE4E6',
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
id: 'emerald',
|
|
260
|
-
name: 'Emerald',
|
|
261
|
-
description: 'Natural e equilibrado',
|
|
262
|
-
colors: {
|
|
263
|
-
primary: '#047857', // Emerald 700 (Better text contrast for Primary)
|
|
264
|
-
primaryForeground: '#FFFFFF',
|
|
265
|
-
primaryLight: '#D1FAE5',
|
|
266
|
-
primaryDarkMode: '#10B981',
|
|
267
|
-
primaryForegroundDark: '#FFFFFF',
|
|
268
|
-
|
|
269
|
-
sidebarLight: '#064E3B', // Emerald 900 (High Contrast Sidebar)
|
|
270
|
-
sidebarDark: '#064E3B',
|
|
271
|
-
|
|
272
|
-
gradientStart: '#059669',
|
|
273
|
-
gradientEnd: '#34D399',
|
|
274
|
-
gradientStartDark: '#064E3B',
|
|
275
|
-
gradientEndDark: '#059669',
|
|
276
|
-
|
|
277
|
-
chart1: '#059669',
|
|
278
|
-
chart2: '#10B981',
|
|
279
|
-
chart3: '#34D399',
|
|
280
|
-
chart4: '#6EE7B7',
|
|
281
|
-
chart5: '#A7F3D0',
|
|
282
|
-
},
|
|
283
|
-
preview: {
|
|
284
|
-
primary: '#047857',
|
|
285
|
-
secondary: '#34D399',
|
|
286
|
-
accent: '#D1FAE5',
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
id: 'amber',
|
|
291
|
-
name: 'Amber',
|
|
292
|
-
description: 'Quente e energético',
|
|
293
|
-
colors: {
|
|
294
|
-
primary: '#B45309', // Amber 700 (Better text contrast for Primary)
|
|
295
|
-
primaryForeground: '#FFFFFF',
|
|
296
|
-
primaryLight: '#FEF3C7',
|
|
297
|
-
primaryDarkMode: '#F59E0B',
|
|
298
|
-
primaryForegroundDark: '#FFFFFF',
|
|
299
|
-
|
|
300
|
-
sidebarLight: '#78350F', // Amber 900 (High Contrast Sidebar)
|
|
301
|
-
sidebarDark: '#78350F',
|
|
302
|
-
|
|
303
|
-
gradientStart: '#D97706',
|
|
304
|
-
gradientEnd: '#FBBF24',
|
|
305
|
-
gradientStartDark: '#92400E',
|
|
306
|
-
gradientEndDark: '#D97706',
|
|
307
|
-
|
|
308
|
-
chart1: '#D97706',
|
|
309
|
-
chart2: '#F59E0B',
|
|
310
|
-
chart3: '#FBBF24',
|
|
311
|
-
chart4: '#FDE68A',
|
|
312
|
-
chart5: '#FEF3C7',
|
|
313
|
-
},
|
|
314
|
-
preview: {
|
|
315
|
-
primary: '#B45309',
|
|
316
|
-
secondary: '#FBBF24',
|
|
317
|
-
accent: '#FEF3C7',
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
id: 'orange',
|
|
322
|
-
name: 'Orange',
|
|
323
|
-
description: 'Vibrante e amigável',
|
|
324
|
-
colors: {
|
|
325
|
-
primary: '#C2410C', // Orange 700 (Better text contrast for Primary)
|
|
326
|
-
primaryForeground: '#FFFFFF',
|
|
327
|
-
primaryLight: '#FFEDD5',
|
|
328
|
-
primaryDarkMode: '#F97316',
|
|
329
|
-
primaryForegroundDark: '#FFFFFF',
|
|
330
|
-
|
|
331
|
-
sidebarLight: '#7C2D12', // Orange 900 (High Contrast Sidebar)
|
|
332
|
-
sidebarDark: '#7C2D12',
|
|
333
|
-
|
|
334
|
-
gradientStart: '#EA580C',
|
|
335
|
-
gradientEnd: '#FB923C',
|
|
336
|
-
gradientStartDark: '#9A3412',
|
|
337
|
-
gradientEndDark: '#EA580C',
|
|
338
|
-
|
|
339
|
-
chart1: '#EA580C',
|
|
340
|
-
chart2: '#F97316',
|
|
341
|
-
chart3: '#FB923C',
|
|
342
|
-
chart4: '#FDBA74',
|
|
343
|
-
chart5: '#FED7AA',
|
|
344
|
-
},
|
|
345
|
-
preview: {
|
|
346
|
-
primary: '#C2410C',
|
|
347
|
-
secondary: '#FB923C',
|
|
348
|
-
accent: '#FFEDD5',
|
|
349
|
-
},
|
|
350
|
-
},
|
|
351
|
-
];
|
|
352
|
-
|
|
353
19
|
const BrandColorsContext = createContext<BrandColorsContextType | undefined>(undefined);
|
|
354
20
|
|
|
355
21
|
export const BrandColorsProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
@@ -377,10 +43,10 @@ export const BrandColorsProvider: React.FC<{ children: React.ReactNode }> = ({ c
|
|
|
377
43
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
378
44
|
return result
|
|
379
45
|
? {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
46
|
+
r: parseInt(result[1], 16),
|
|
47
|
+
g: parseInt(result[2], 16),
|
|
48
|
+
b: parseInt(result[3], 16),
|
|
49
|
+
}
|
|
384
50
|
: null;
|
|
385
51
|
};
|
|
386
52
|
|
|
@@ -388,11 +54,11 @@ export const BrandColorsProvider: React.FC<{ children: React.ReactNode }> = ({ c
|
|
|
388
54
|
const applyColors = React.useCallback(() => {
|
|
389
55
|
const root = document.documentElement;
|
|
390
56
|
const isDark = root.classList.contains('dark');
|
|
391
|
-
|
|
57
|
+
|
|
392
58
|
// --- Determine Colors based on Mode ---
|
|
393
59
|
const primary = isDark ? colors.primaryDarkMode : colors.primary;
|
|
394
60
|
const primaryForeground = isDark ? colors.primaryForegroundDark : colors.primaryForeground;
|
|
395
|
-
|
|
61
|
+
|
|
396
62
|
// Gradient Logic
|
|
397
63
|
const gradientStart = isDark ? colors.gradientStartDark : colors.gradientStart;
|
|
398
64
|
const gradientEnd = isDark ? colors.gradientEndDark : colors.gradientEnd;
|
|
@@ -402,10 +68,10 @@ export const BrandColorsProvider: React.FC<{ children: React.ReactNode }> = ({ c
|
|
|
402
68
|
const semantic = {
|
|
403
69
|
success: isDark ? '#4ade80' : '#22c55e', // Green 400 / 500
|
|
404
70
|
warning: isDark ? '#fbbf24' : '#f59e0b', // Amber 400 / 500
|
|
405
|
-
info:
|
|
71
|
+
info: isDark ? '#60a5fa' : '#3b82f6', // Blue 400 / 500
|
|
406
72
|
destructive: isDark ? '#f87171' : '#ef4444', // Red 400 / 500
|
|
407
73
|
};
|
|
408
|
-
|
|
74
|
+
|
|
409
75
|
// --- Apply CSS Variables ---
|
|
410
76
|
|
|
411
77
|
// 1. Core Primary Colors
|
|
@@ -421,29 +87,29 @@ export const BrandColorsProvider: React.FC<{ children: React.ReactNode }> = ({ c
|
|
|
421
87
|
root.style.setProperty('--info-foreground', '#ffffff');
|
|
422
88
|
root.style.setProperty('--destructive', semantic.destructive);
|
|
423
89
|
root.style.setProperty('--destructive-foreground', '#ffffff');
|
|
424
|
-
|
|
90
|
+
|
|
425
91
|
// 3. Secondary & Accents (Derived or Specific)
|
|
426
|
-
|
|
92
|
+
|
|
427
93
|
// 2. Secondary & Accents (Derived or Specific)
|
|
428
94
|
// We use primaryLight for subtle backgrounds
|
|
429
95
|
// In dark mode, we might want to adjust opacity
|
|
430
96
|
const primaryRGB = hexToRgb(primary);
|
|
431
97
|
if (primaryRGB) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
98
|
+
// Create a subtle tint for secondary/accent/muted
|
|
99
|
+
const alpha = isDark ? 0.2 : 0.1;
|
|
100
|
+
const subtle = `rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, ${alpha})`;
|
|
101
|
+
|
|
102
|
+
// Note: Shadcn usually has specific greys for secondary, but for "Brand" themes
|
|
103
|
+
// we can tint them slightly or stick to standard zinc.
|
|
104
|
+
// For this implementation, we will keep existing "neutral" variables from CSS
|
|
105
|
+
// but override "ring" and "sidebar-ring" to match brand.
|
|
106
|
+
|
|
107
|
+
root.style.setProperty('--ring', isDark ? colors.primaryDarkMode : `rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.5)`);
|
|
108
|
+
|
|
109
|
+
// Also update the Xertica specific variables
|
|
110
|
+
root.style.setProperty('--xertica-primary', primary);
|
|
111
|
+
root.style.setProperty('--primary-light', `rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.15)`);
|
|
112
|
+
root.style.setProperty('--primary-light-foreground', primary);
|
|
447
113
|
}
|
|
448
114
|
|
|
449
115
|
// 3. Radius
|
|
@@ -459,47 +125,47 @@ export const BrandColorsProvider: React.FC<{ children: React.ReactNode }> = ({ c
|
|
|
459
125
|
// 5. Sidebar (Override)
|
|
460
126
|
// Dynamic sidebar colors based on theme and mode
|
|
461
127
|
const sidebarBg = isDark ? colors.sidebarDark : colors.sidebarLight;
|
|
462
|
-
|
|
128
|
+
|
|
463
129
|
// Determine if sidebar background is dark or light to set text color
|
|
464
130
|
// We assume if the sidebar background is the Primary Color (which are generally dark/saturated), text should be white.
|
|
465
131
|
// Xertica Original (Purple), Blue, Violet, etc. are all dark.
|
|
466
132
|
// If sidebarLight is White (#FFFFFF) or very light, text should be dark.
|
|
467
|
-
|
|
133
|
+
|
|
468
134
|
// Simple check: is sidebarBg roughly White/Light?
|
|
469
135
|
const isSidebarLight = sidebarBg.toLowerCase() === '#ffffff' || sidebarBg.toLowerCase() === '#f3f4f6' || sidebarBg.toLowerCase() === '#fafafa';
|
|
470
|
-
|
|
136
|
+
|
|
471
137
|
const sidebarFg = isSidebarLight ? '#0F172A' : '#FFFFFF'; // Dark text for light BG, White text for dark BG
|
|
472
|
-
|
|
138
|
+
|
|
473
139
|
root.style.setProperty('--sidebar', sidebarBg);
|
|
474
140
|
root.style.setProperty('--sidebar-foreground', sidebarFg);
|
|
475
|
-
|
|
141
|
+
|
|
476
142
|
// Sidebar Accent
|
|
477
143
|
if (primaryRGB) {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
144
|
+
if (isSidebarLight) {
|
|
145
|
+
// Standard behavior for light sidebar
|
|
146
|
+
root.style.setProperty('--sidebar-accent', `rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.1)`);
|
|
147
|
+
root.style.setProperty('--sidebar-accent-foreground', primary);
|
|
148
|
+
root.style.setProperty('--sidebar-border', 'rgba(0,0,0,0.1)');
|
|
149
|
+
} else {
|
|
150
|
+
// Behavior for colored/dark sidebar
|
|
151
|
+
// Accent should be a slightly lighter/darker shade of the sidebar bg
|
|
152
|
+
// Or white with low opacity
|
|
153
|
+
root.style.setProperty('--sidebar-accent', 'rgba(255, 255, 255, 0.1)');
|
|
154
|
+
root.style.setProperty('--sidebar-accent-foreground', '#FFFFFF');
|
|
155
|
+
root.style.setProperty('--sidebar-border', 'rgba(255,255,255,0.1)');
|
|
156
|
+
}
|
|
157
|
+
root.style.setProperty('--sidebar-ring', `rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.5)`);
|
|
492
158
|
}
|
|
493
159
|
|
|
494
160
|
// Sidebar Primary (Active Item)
|
|
495
161
|
// If sidebar is colored (dark), the primary active item usually looks good as white or a very bright accent.
|
|
496
162
|
// But standard "Primary" might clash if it's the same color as the background.
|
|
497
163
|
if (!isSidebarLight) {
|
|
498
|
-
|
|
499
|
-
|
|
164
|
+
root.style.setProperty('--sidebar-primary', '#FFFFFF');
|
|
165
|
+
root.style.setProperty('--sidebar-primary-foreground', primary); // Text becomes primary color
|
|
500
166
|
} else {
|
|
501
|
-
|
|
502
|
-
|
|
167
|
+
root.style.setProperty('--sidebar-primary', primary);
|
|
168
|
+
root.style.setProperty('--sidebar-primary-foreground', primaryForeground);
|
|
503
169
|
}
|
|
504
170
|
|
|
505
171
|
// 6. Gradients
|
|
@@ -507,7 +173,7 @@ export const BrandColorsProvider: React.FC<{ children: React.ReactNode }> = ({ c
|
|
|
507
173
|
'--gradient-diagonal',
|
|
508
174
|
`linear-gradient(135deg, ${gradientStart} 0%, ${gradientEnd} 100%)`
|
|
509
175
|
);
|
|
510
|
-
|
|
176
|
+
|
|
511
177
|
// Save preferences
|
|
512
178
|
localStorage.setItem('color-theme', currentTheme);
|
|
513
179
|
}, [colors, currentTheme, radius]);
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
export interface BrandColors {
|
|
2
|
+
// Main Colors
|
|
3
|
+
primary: string;
|
|
4
|
+
primaryForeground: string;
|
|
5
|
+
primaryLight: string; // Used for backgrounds
|
|
6
|
+
|
|
7
|
+
// Dark Mode Overrides
|
|
8
|
+
primaryDarkMode: string;
|
|
9
|
+
primaryForegroundDark: string;
|
|
10
|
+
|
|
11
|
+
// Sidebar Colors
|
|
12
|
+
sidebarLight: string;
|
|
13
|
+
sidebarDark: string;
|
|
14
|
+
|
|
15
|
+
// Gradients
|
|
16
|
+
gradientStart: string;
|
|
17
|
+
gradientEnd: string;
|
|
18
|
+
gradientStartDark: string;
|
|
19
|
+
gradientEndDark: string;
|
|
20
|
+
|
|
21
|
+
// Chart Colors (Light Mode) - Dark mode will be calculated or fixed
|
|
22
|
+
chart1: string;
|
|
23
|
+
chart2: string;
|
|
24
|
+
chart3: string;
|
|
25
|
+
chart4: string;
|
|
26
|
+
chart5: string;
|
|
27
|
+
|
|
28
|
+
// Optional: Radius override per theme
|
|
29
|
+
radius?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ColorTheme {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
colors: BrandColors;
|
|
37
|
+
preview: {
|
|
38
|
+
primary: string;
|
|
39
|
+
secondary: string;
|
|
40
|
+
accent: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Shadcn Standard Palette Values (approximate hex for compatibility)
|
|
45
|
+
export const PALETTE = {
|
|
46
|
+
zinc: { 900: '#18181b', 50: '#fafafa' },
|
|
47
|
+
slate: { 900: '#0f172a', 50: '#f8fafc' },
|
|
48
|
+
stone: { 900: '#1c1917', 50: '#fafaf9' },
|
|
49
|
+
gray: { 900: '#111827', 50: '#f9fafb' },
|
|
50
|
+
neutral: { 900: '#171717', 50: '#fafafa' },
|
|
51
|
+
red: { 600: '#dc2626', 500: '#ef4444' },
|
|
52
|
+
rose: { 600: '#e11d48', 500: '#f43f5e' },
|
|
53
|
+
orange: { 600: '#ea580c', 500: '#f97316' },
|
|
54
|
+
green: { 600: '#16a34a', 500: '#22c55e' },
|
|
55
|
+
blue: { 600: '#2563eb', 500: '#3b82f6' },
|
|
56
|
+
yellow: { 600: '#ca8a04', 500: '#eab308' },
|
|
57
|
+
violet: { 600: '#7c3aed', 500: '#8b5cf6' },
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const colorThemes: ColorTheme[] = [
|
|
61
|
+
{
|
|
62
|
+
id: 'xertica-original',
|
|
63
|
+
name: 'Xertica Original',
|
|
64
|
+
description: 'A identidade visual clássica da Xertica com o gradiente original',
|
|
65
|
+
colors: {
|
|
66
|
+
primary: '#2C275B',
|
|
67
|
+
primaryForeground: '#FFFFFF',
|
|
68
|
+
primaryLight: '#5B568F',
|
|
69
|
+
primaryDarkMode: '#72CDFD',
|
|
70
|
+
primaryForegroundDark: '#09090B',
|
|
71
|
+
|
|
72
|
+
sidebarLight: '#2C275B', // Primary Color
|
|
73
|
+
sidebarDark: '#1a1928', // Original Dark BG
|
|
74
|
+
|
|
75
|
+
gradientStart: '#FDB0F2',
|
|
76
|
+
gradientEnd: '#72CDFD',
|
|
77
|
+
gradientStartDark: '#7B4A7A',
|
|
78
|
+
gradientEndDark: '#3A5C7D',
|
|
79
|
+
|
|
80
|
+
chart1: '#2C275B',
|
|
81
|
+
chart2: '#FDB0F2',
|
|
82
|
+
chart3: '#72CDFD',
|
|
83
|
+
chart4: '#5B568F',
|
|
84
|
+
chart5: '#4F46E5',
|
|
85
|
+
},
|
|
86
|
+
preview: {
|
|
87
|
+
primary: '#2C275B',
|
|
88
|
+
secondary: '#FDB0F2',
|
|
89
|
+
accent: '#72CDFD',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'zinc',
|
|
94
|
+
name: 'Zinc',
|
|
95
|
+
description: 'Minimalista, sério e elegante (Escala de Cinza)',
|
|
96
|
+
colors: {
|
|
97
|
+
primary: '#18181B',
|
|
98
|
+
primaryForeground: '#FAFAFA',
|
|
99
|
+
primaryLight: '#E4E4E7',
|
|
100
|
+
primaryDarkMode: '#FAFAFA',
|
|
101
|
+
primaryForegroundDark: '#18181B',
|
|
102
|
+
|
|
103
|
+
sidebarLight: '#18181B', // Primary Color
|
|
104
|
+
sidebarDark: '#09090B',
|
|
105
|
+
|
|
106
|
+
gradientStart: '#52525B',
|
|
107
|
+
gradientEnd: '#D4D4D8',
|
|
108
|
+
gradientStartDark: '#27272A',
|
|
109
|
+
gradientEndDark: '#52525B',
|
|
110
|
+
|
|
111
|
+
chart1: '#18181B',
|
|
112
|
+
chart2: '#52525B',
|
|
113
|
+
chart3: '#A1A1AA',
|
|
114
|
+
chart4: '#D4D4D8',
|
|
115
|
+
chart5: '#E4E4E7',
|
|
116
|
+
},
|
|
117
|
+
preview: {
|
|
118
|
+
primary: '#18181B',
|
|
119
|
+
secondary: '#52525B',
|
|
120
|
+
accent: '#E4E4E7',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: 'slate',
|
|
125
|
+
name: 'Slate',
|
|
126
|
+
description: 'Profissional com tons de azul acinzentado',
|
|
127
|
+
colors: {
|
|
128
|
+
primary: '#0F172A',
|
|
129
|
+
primaryForeground: '#F8FAFC',
|
|
130
|
+
primaryLight: '#CBD5E1',
|
|
131
|
+
primaryDarkMode: '#F8FAFC',
|
|
132
|
+
primaryForegroundDark: '#0F172A',
|
|
133
|
+
|
|
134
|
+
sidebarLight: '#0F172A', // Primary Color
|
|
135
|
+
sidebarDark: '#020617',
|
|
136
|
+
|
|
137
|
+
gradientStart: '#475569',
|
|
138
|
+
gradientEnd: '#94A3B8',
|
|
139
|
+
gradientStartDark: '#1E293B',
|
|
140
|
+
gradientEndDark: '#475569',
|
|
141
|
+
|
|
142
|
+
chart1: '#0F172A',
|
|
143
|
+
chart2: '#475569',
|
|
144
|
+
chart3: '#94A3B8',
|
|
145
|
+
chart4: '#CBD5E1',
|
|
146
|
+
chart5: '#E2E8F0',
|
|
147
|
+
},
|
|
148
|
+
preview: {
|
|
149
|
+
primary: '#0F172A',
|
|
150
|
+
secondary: '#475569',
|
|
151
|
+
accent: '#94A3B8',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: 'blue',
|
|
156
|
+
name: 'Blue',
|
|
157
|
+
description: 'Confiável e seguro, padrão corporativo',
|
|
158
|
+
colors: {
|
|
159
|
+
primary: '#2563EB',
|
|
160
|
+
primaryForeground: '#FFFFFF',
|
|
161
|
+
primaryLight: '#DBEAFE',
|
|
162
|
+
primaryDarkMode: '#3B82F6',
|
|
163
|
+
primaryForegroundDark: '#FFFFFF',
|
|
164
|
+
|
|
165
|
+
sidebarLight: '#1E3A8A', // Blue 900 (High Contrast Sidebar)
|
|
166
|
+
sidebarDark: '#172554',
|
|
167
|
+
|
|
168
|
+
gradientStart: '#2563EB',
|
|
169
|
+
gradientEnd: '#60A5FA',
|
|
170
|
+
gradientStartDark: '#1D4ED8',
|
|
171
|
+
gradientEndDark: '#2563EB',
|
|
172
|
+
|
|
173
|
+
chart1: '#2563EB',
|
|
174
|
+
chart2: '#3B82F6',
|
|
175
|
+
chart3: '#60A5FA',
|
|
176
|
+
chart4: '#93C5FD',
|
|
177
|
+
chart5: '#BFDBFE',
|
|
178
|
+
},
|
|
179
|
+
preview: {
|
|
180
|
+
primary: '#2563EB',
|
|
181
|
+
secondary: '#60A5FA',
|
|
182
|
+
accent: '#DBEAFE',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: 'violet',
|
|
187
|
+
name: 'Violet',
|
|
188
|
+
description: 'Criativo e vibrante',
|
|
189
|
+
colors: {
|
|
190
|
+
primary: '#7C3AED',
|
|
191
|
+
primaryForeground: '#FFFFFF',
|
|
192
|
+
primaryLight: '#EDE9FE',
|
|
193
|
+
primaryDarkMode: '#8B5CF6',
|
|
194
|
+
primaryForegroundDark: '#FFFFFF',
|
|
195
|
+
|
|
196
|
+
sidebarLight: '#4C1D95', // Violet 900 (High Contrast Sidebar)
|
|
197
|
+
sidebarDark: '#2E1065',
|
|
198
|
+
|
|
199
|
+
gradientStart: '#7C3AED',
|
|
200
|
+
gradientEnd: '#A78BFA',
|
|
201
|
+
gradientStartDark: '#5B21B6',
|
|
202
|
+
gradientEndDark: '#7C3AED',
|
|
203
|
+
|
|
204
|
+
chart1: '#7C3AED',
|
|
205
|
+
chart2: '#8B5CF6',
|
|
206
|
+
chart3: '#A78BFA',
|
|
207
|
+
chart4: '#C4B5FD',
|
|
208
|
+
chart5: '#DDD6FE',
|
|
209
|
+
},
|
|
210
|
+
preview: {
|
|
211
|
+
primary: '#7C3AED',
|
|
212
|
+
secondary: '#A78BFA',
|
|
213
|
+
accent: '#EDE9FE',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: 'rose',
|
|
218
|
+
name: 'Rose',
|
|
219
|
+
description: 'Elegante e suave',
|
|
220
|
+
colors: {
|
|
221
|
+
primary: '#BE123C', // Rose 700 (Better text contrast for Primary)
|
|
222
|
+
primaryForeground: '#FFFFFF',
|
|
223
|
+
primaryLight: '#FFE4E6',
|
|
224
|
+
primaryDarkMode: '#F43F5E',
|
|
225
|
+
primaryForegroundDark: '#FFFFFF',
|
|
226
|
+
|
|
227
|
+
sidebarLight: '#881337', // Rose 900 (High Contrast Sidebar)
|
|
228
|
+
sidebarDark: '#881337',
|
|
229
|
+
|
|
230
|
+
gradientStart: '#E11D48',
|
|
231
|
+
gradientEnd: '#FB7185',
|
|
232
|
+
gradientStartDark: '#9F1239',
|
|
233
|
+
gradientEndDark: '#E11D48',
|
|
234
|
+
|
|
235
|
+
chart1: '#E11D48',
|
|
236
|
+
chart2: '#F43F5E',
|
|
237
|
+
chart3: '#FB7185',
|
|
238
|
+
chart4: '#FDA4AF',
|
|
239
|
+
chart5: '#FECDD3',
|
|
240
|
+
},
|
|
241
|
+
preview: {
|
|
242
|
+
primary: '#BE123C',
|
|
243
|
+
secondary: '#FB7185',
|
|
244
|
+
accent: '#FFE4E6',
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: 'emerald',
|
|
249
|
+
name: 'Emerald',
|
|
250
|
+
description: 'Natural e equilibrado',
|
|
251
|
+
colors: {
|
|
252
|
+
primary: '#047857', // Emerald 700 (Better text contrast for Primary)
|
|
253
|
+
primaryForeground: '#FFFFFF',
|
|
254
|
+
primaryLight: '#D1FAE5',
|
|
255
|
+
primaryDarkMode: '#10B981',
|
|
256
|
+
primaryForegroundDark: '#FFFFFF',
|
|
257
|
+
|
|
258
|
+
sidebarLight: '#064E3B', // Emerald 900 (High Contrast Sidebar)
|
|
259
|
+
sidebarDark: '#064E3B',
|
|
260
|
+
|
|
261
|
+
gradientStart: '#059669',
|
|
262
|
+
gradientEnd: '#34D399',
|
|
263
|
+
gradientStartDark: '#064E3B',
|
|
264
|
+
gradientEndDark: '#059669',
|
|
265
|
+
|
|
266
|
+
chart1: '#059669',
|
|
267
|
+
chart2: '#10B981',
|
|
268
|
+
chart3: '#34D399',
|
|
269
|
+
chart4: '#6EE7B7',
|
|
270
|
+
chart5: '#A7F3D0',
|
|
271
|
+
},
|
|
272
|
+
preview: {
|
|
273
|
+
primary: '#047857',
|
|
274
|
+
secondary: '#34D399',
|
|
275
|
+
accent: '#D1FAE5',
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: 'amber',
|
|
280
|
+
name: 'Amber',
|
|
281
|
+
description: 'Quente e energético',
|
|
282
|
+
colors: {
|
|
283
|
+
primary: '#B45309', // Amber 700 (Better text contrast for Primary)
|
|
284
|
+
primaryForeground: '#FFFFFF',
|
|
285
|
+
primaryLight: '#FEF3C7',
|
|
286
|
+
primaryDarkMode: '#F59E0B',
|
|
287
|
+
primaryForegroundDark: '#FFFFFF',
|
|
288
|
+
|
|
289
|
+
sidebarLight: '#78350F', // Amber 900 (High Contrast Sidebar)
|
|
290
|
+
sidebarDark: '#78350F',
|
|
291
|
+
|
|
292
|
+
gradientStart: '#D97706',
|
|
293
|
+
gradientEnd: '#FBBF24',
|
|
294
|
+
gradientStartDark: '#92400E',
|
|
295
|
+
gradientEndDark: '#D97706',
|
|
296
|
+
|
|
297
|
+
chart1: '#D97706',
|
|
298
|
+
chart2: '#F59E0B',
|
|
299
|
+
chart3: '#FBBF24',
|
|
300
|
+
chart4: '#FDE68A',
|
|
301
|
+
chart5: '#FEF3C7',
|
|
302
|
+
},
|
|
303
|
+
preview: {
|
|
304
|
+
primary: '#B45309',
|
|
305
|
+
secondary: '#FBBF24',
|
|
306
|
+
accent: '#FEF3C7',
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: 'orange',
|
|
311
|
+
name: 'Orange',
|
|
312
|
+
description: 'Vibrante e amigável',
|
|
313
|
+
colors: {
|
|
314
|
+
primary: '#C2410C', // Orange 700 (Better text contrast for Primary)
|
|
315
|
+
primaryForeground: '#FFFFFF',
|
|
316
|
+
primaryLight: '#FFEDD5',
|
|
317
|
+
primaryDarkMode: '#F97316',
|
|
318
|
+
primaryForegroundDark: '#FFFFFF',
|
|
319
|
+
|
|
320
|
+
sidebarLight: '#7C2D12', // Orange 900 (High Contrast Sidebar)
|
|
321
|
+
sidebarDark: '#7C2D12',
|
|
322
|
+
|
|
323
|
+
gradientStart: '#EA580C',
|
|
324
|
+
gradientEnd: '#FB923C',
|
|
325
|
+
gradientStartDark: '#9A3412',
|
|
326
|
+
gradientEndDark: '#EA580C',
|
|
327
|
+
|
|
328
|
+
chart1: '#EA580C',
|
|
329
|
+
chart2: '#F97316',
|
|
330
|
+
chart3: '#FB923C',
|
|
331
|
+
chart4: '#FDBA74',
|
|
332
|
+
chart5: '#FED7AA',
|
|
333
|
+
},
|
|
334
|
+
preview: {
|
|
335
|
+
primary: '#C2410C',
|
|
336
|
+
secondary: '#FB923C',
|
|
337
|
+
accent: '#FFEDD5',
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
];
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,278 @@ import fs from "fs-extra";
|
|
|
9
9
|
import path from "path";
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
11
|
import { execa } from "execa";
|
|
12
|
+
|
|
13
|
+
// contexts/theme-data.ts
|
|
14
|
+
var colorThemes = [
|
|
15
|
+
{
|
|
16
|
+
id: "xertica-original",
|
|
17
|
+
name: "Xertica Original",
|
|
18
|
+
description: "A identidade visual cl\xE1ssica da Xertica com o gradiente original",
|
|
19
|
+
colors: {
|
|
20
|
+
primary: "#2C275B",
|
|
21
|
+
primaryForeground: "#FFFFFF",
|
|
22
|
+
primaryLight: "#5B568F",
|
|
23
|
+
primaryDarkMode: "#72CDFD",
|
|
24
|
+
primaryForegroundDark: "#09090B",
|
|
25
|
+
sidebarLight: "#2C275B",
|
|
26
|
+
// Primary Color
|
|
27
|
+
sidebarDark: "#1a1928",
|
|
28
|
+
// Original Dark BG
|
|
29
|
+
gradientStart: "#FDB0F2",
|
|
30
|
+
gradientEnd: "#72CDFD",
|
|
31
|
+
gradientStartDark: "#7B4A7A",
|
|
32
|
+
gradientEndDark: "#3A5C7D",
|
|
33
|
+
chart1: "#2C275B",
|
|
34
|
+
chart2: "#FDB0F2",
|
|
35
|
+
chart3: "#72CDFD",
|
|
36
|
+
chart4: "#5B568F",
|
|
37
|
+
chart5: "#4F46E5"
|
|
38
|
+
},
|
|
39
|
+
preview: {
|
|
40
|
+
primary: "#2C275B",
|
|
41
|
+
secondary: "#FDB0F2",
|
|
42
|
+
accent: "#72CDFD"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "zinc",
|
|
47
|
+
name: "Zinc",
|
|
48
|
+
description: "Minimalista, s\xE9rio e elegante (Escala de Cinza)",
|
|
49
|
+
colors: {
|
|
50
|
+
primary: "#18181B",
|
|
51
|
+
primaryForeground: "#FAFAFA",
|
|
52
|
+
primaryLight: "#E4E4E7",
|
|
53
|
+
primaryDarkMode: "#FAFAFA",
|
|
54
|
+
primaryForegroundDark: "#18181B",
|
|
55
|
+
sidebarLight: "#18181B",
|
|
56
|
+
// Primary Color
|
|
57
|
+
sidebarDark: "#09090B",
|
|
58
|
+
gradientStart: "#52525B",
|
|
59
|
+
gradientEnd: "#D4D4D8",
|
|
60
|
+
gradientStartDark: "#27272A",
|
|
61
|
+
gradientEndDark: "#52525B",
|
|
62
|
+
chart1: "#18181B",
|
|
63
|
+
chart2: "#52525B",
|
|
64
|
+
chart3: "#A1A1AA",
|
|
65
|
+
chart4: "#D4D4D8",
|
|
66
|
+
chart5: "#E4E4E7"
|
|
67
|
+
},
|
|
68
|
+
preview: {
|
|
69
|
+
primary: "#18181B",
|
|
70
|
+
secondary: "#52525B",
|
|
71
|
+
accent: "#E4E4E7"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "slate",
|
|
76
|
+
name: "Slate",
|
|
77
|
+
description: "Profissional com tons de azul acinzentado",
|
|
78
|
+
colors: {
|
|
79
|
+
primary: "#0F172A",
|
|
80
|
+
primaryForeground: "#F8FAFC",
|
|
81
|
+
primaryLight: "#CBD5E1",
|
|
82
|
+
primaryDarkMode: "#F8FAFC",
|
|
83
|
+
primaryForegroundDark: "#0F172A",
|
|
84
|
+
sidebarLight: "#0F172A",
|
|
85
|
+
// Primary Color
|
|
86
|
+
sidebarDark: "#020617",
|
|
87
|
+
gradientStart: "#475569",
|
|
88
|
+
gradientEnd: "#94A3B8",
|
|
89
|
+
gradientStartDark: "#1E293B",
|
|
90
|
+
gradientEndDark: "#475569",
|
|
91
|
+
chart1: "#0F172A",
|
|
92
|
+
chart2: "#475569",
|
|
93
|
+
chart3: "#94A3B8",
|
|
94
|
+
chart4: "#CBD5E1",
|
|
95
|
+
chart5: "#E2E8F0"
|
|
96
|
+
},
|
|
97
|
+
preview: {
|
|
98
|
+
primary: "#0F172A",
|
|
99
|
+
secondary: "#475569",
|
|
100
|
+
accent: "#94A3B8"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "blue",
|
|
105
|
+
name: "Blue",
|
|
106
|
+
description: "Confi\xE1vel e seguro, padr\xE3o corporativo",
|
|
107
|
+
colors: {
|
|
108
|
+
primary: "#2563EB",
|
|
109
|
+
primaryForeground: "#FFFFFF",
|
|
110
|
+
primaryLight: "#DBEAFE",
|
|
111
|
+
primaryDarkMode: "#3B82F6",
|
|
112
|
+
primaryForegroundDark: "#FFFFFF",
|
|
113
|
+
sidebarLight: "#1E3A8A",
|
|
114
|
+
// Blue 900 (High Contrast Sidebar)
|
|
115
|
+
sidebarDark: "#172554",
|
|
116
|
+
gradientStart: "#2563EB",
|
|
117
|
+
gradientEnd: "#60A5FA",
|
|
118
|
+
gradientStartDark: "#1D4ED8",
|
|
119
|
+
gradientEndDark: "#2563EB",
|
|
120
|
+
chart1: "#2563EB",
|
|
121
|
+
chart2: "#3B82F6",
|
|
122
|
+
chart3: "#60A5FA",
|
|
123
|
+
chart4: "#93C5FD",
|
|
124
|
+
chart5: "#BFDBFE"
|
|
125
|
+
},
|
|
126
|
+
preview: {
|
|
127
|
+
primary: "#2563EB",
|
|
128
|
+
secondary: "#60A5FA",
|
|
129
|
+
accent: "#DBEAFE"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "violet",
|
|
134
|
+
name: "Violet",
|
|
135
|
+
description: "Criativo e vibrante",
|
|
136
|
+
colors: {
|
|
137
|
+
primary: "#7C3AED",
|
|
138
|
+
primaryForeground: "#FFFFFF",
|
|
139
|
+
primaryLight: "#EDE9FE",
|
|
140
|
+
primaryDarkMode: "#8B5CF6",
|
|
141
|
+
primaryForegroundDark: "#FFFFFF",
|
|
142
|
+
sidebarLight: "#4C1D95",
|
|
143
|
+
// Violet 900 (High Contrast Sidebar)
|
|
144
|
+
sidebarDark: "#2E1065",
|
|
145
|
+
gradientStart: "#7C3AED",
|
|
146
|
+
gradientEnd: "#A78BFA",
|
|
147
|
+
gradientStartDark: "#5B21B6",
|
|
148
|
+
gradientEndDark: "#7C3AED",
|
|
149
|
+
chart1: "#7C3AED",
|
|
150
|
+
chart2: "#8B5CF6",
|
|
151
|
+
chart3: "#A78BFA",
|
|
152
|
+
chart4: "#C4B5FD",
|
|
153
|
+
chart5: "#DDD6FE"
|
|
154
|
+
},
|
|
155
|
+
preview: {
|
|
156
|
+
primary: "#7C3AED",
|
|
157
|
+
secondary: "#A78BFA",
|
|
158
|
+
accent: "#EDE9FE"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: "rose",
|
|
163
|
+
name: "Rose",
|
|
164
|
+
description: "Elegante e suave",
|
|
165
|
+
colors: {
|
|
166
|
+
primary: "#BE123C",
|
|
167
|
+
// Rose 700 (Better text contrast for Primary)
|
|
168
|
+
primaryForeground: "#FFFFFF",
|
|
169
|
+
primaryLight: "#FFE4E6",
|
|
170
|
+
primaryDarkMode: "#F43F5E",
|
|
171
|
+
primaryForegroundDark: "#FFFFFF",
|
|
172
|
+
sidebarLight: "#881337",
|
|
173
|
+
// Rose 900 (High Contrast Sidebar)
|
|
174
|
+
sidebarDark: "#881337",
|
|
175
|
+
gradientStart: "#E11D48",
|
|
176
|
+
gradientEnd: "#FB7185",
|
|
177
|
+
gradientStartDark: "#9F1239",
|
|
178
|
+
gradientEndDark: "#E11D48",
|
|
179
|
+
chart1: "#E11D48",
|
|
180
|
+
chart2: "#F43F5E",
|
|
181
|
+
chart3: "#FB7185",
|
|
182
|
+
chart4: "#FDA4AF",
|
|
183
|
+
chart5: "#FECDD3"
|
|
184
|
+
},
|
|
185
|
+
preview: {
|
|
186
|
+
primary: "#BE123C",
|
|
187
|
+
secondary: "#FB7185",
|
|
188
|
+
accent: "#FFE4E6"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "emerald",
|
|
193
|
+
name: "Emerald",
|
|
194
|
+
description: "Natural e equilibrado",
|
|
195
|
+
colors: {
|
|
196
|
+
primary: "#047857",
|
|
197
|
+
// Emerald 700 (Better text contrast for Primary)
|
|
198
|
+
primaryForeground: "#FFFFFF",
|
|
199
|
+
primaryLight: "#D1FAE5",
|
|
200
|
+
primaryDarkMode: "#10B981",
|
|
201
|
+
primaryForegroundDark: "#FFFFFF",
|
|
202
|
+
sidebarLight: "#064E3B",
|
|
203
|
+
// Emerald 900 (High Contrast Sidebar)
|
|
204
|
+
sidebarDark: "#064E3B",
|
|
205
|
+
gradientStart: "#059669",
|
|
206
|
+
gradientEnd: "#34D399",
|
|
207
|
+
gradientStartDark: "#064E3B",
|
|
208
|
+
gradientEndDark: "#059669",
|
|
209
|
+
chart1: "#059669",
|
|
210
|
+
chart2: "#10B981",
|
|
211
|
+
chart3: "#34D399",
|
|
212
|
+
chart4: "#6EE7B7",
|
|
213
|
+
chart5: "#A7F3D0"
|
|
214
|
+
},
|
|
215
|
+
preview: {
|
|
216
|
+
primary: "#047857",
|
|
217
|
+
secondary: "#34D399",
|
|
218
|
+
accent: "#D1FAE5"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: "amber",
|
|
223
|
+
name: "Amber",
|
|
224
|
+
description: "Quente e energ\xE9tico",
|
|
225
|
+
colors: {
|
|
226
|
+
primary: "#B45309",
|
|
227
|
+
// Amber 700 (Better text contrast for Primary)
|
|
228
|
+
primaryForeground: "#FFFFFF",
|
|
229
|
+
primaryLight: "#FEF3C7",
|
|
230
|
+
primaryDarkMode: "#F59E0B",
|
|
231
|
+
primaryForegroundDark: "#FFFFFF",
|
|
232
|
+
sidebarLight: "#78350F",
|
|
233
|
+
// Amber 900 (High Contrast Sidebar)
|
|
234
|
+
sidebarDark: "#78350F",
|
|
235
|
+
gradientStart: "#D97706",
|
|
236
|
+
gradientEnd: "#FBBF24",
|
|
237
|
+
gradientStartDark: "#92400E",
|
|
238
|
+
gradientEndDark: "#D97706",
|
|
239
|
+
chart1: "#D97706",
|
|
240
|
+
chart2: "#F59E0B",
|
|
241
|
+
chart3: "#FBBF24",
|
|
242
|
+
chart4: "#FDE68A",
|
|
243
|
+
chart5: "#FEF3C7"
|
|
244
|
+
},
|
|
245
|
+
preview: {
|
|
246
|
+
primary: "#B45309",
|
|
247
|
+
secondary: "#FBBF24",
|
|
248
|
+
accent: "#FEF3C7"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: "orange",
|
|
253
|
+
name: "Orange",
|
|
254
|
+
description: "Vibrante e amig\xE1vel",
|
|
255
|
+
colors: {
|
|
256
|
+
primary: "#C2410C",
|
|
257
|
+
// Orange 700 (Better text contrast for Primary)
|
|
258
|
+
primaryForeground: "#FFFFFF",
|
|
259
|
+
primaryLight: "#FFEDD5",
|
|
260
|
+
primaryDarkMode: "#F97316",
|
|
261
|
+
primaryForegroundDark: "#FFFFFF",
|
|
262
|
+
sidebarLight: "#7C2D12",
|
|
263
|
+
// Orange 900 (High Contrast Sidebar)
|
|
264
|
+
sidebarDark: "#7C2D12",
|
|
265
|
+
gradientStart: "#EA580C",
|
|
266
|
+
gradientEnd: "#FB923C",
|
|
267
|
+
gradientStartDark: "#9A3412",
|
|
268
|
+
gradientEndDark: "#EA580C",
|
|
269
|
+
chart1: "#EA580C",
|
|
270
|
+
chart2: "#F97316",
|
|
271
|
+
chart3: "#FB923C",
|
|
272
|
+
chart4: "#FDBA74",
|
|
273
|
+
chart5: "#FED7AA"
|
|
274
|
+
},
|
|
275
|
+
preview: {
|
|
276
|
+
primary: "#C2410C",
|
|
277
|
+
secondary: "#FB923C",
|
|
278
|
+
accent: "#FFEDD5"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
// bin/cli.ts
|
|
12
284
|
var __filename = fileURLToPath(import.meta.url);
|
|
13
285
|
var __dirname = path.dirname(__filename);
|
|
14
286
|
var program = new Command();
|
|
@@ -20,7 +292,7 @@ program.command("init").description("Initialize a new Xertica UI project").argum
|
|
|
20
292
|
let componentChoices = [{ title: "All Components", value: "all", selected: true }];
|
|
21
293
|
if (await fs.pathExists(uiComponentsDir)) {
|
|
22
294
|
const files = await fs.readdir(uiComponentsDir);
|
|
23
|
-
const components = files.filter((f) => f.endsWith(".tsx") && !f.startsWith("index")).map((f) => ({ title: f.replace(".tsx", ""), value: f }));
|
|
295
|
+
const components = files.filter((f) => f.endsWith(".tsx") && !f.startsWith("index")).map((f) => ({ title: f.replace(".tsx", ""), value: f, selected: true }));
|
|
24
296
|
componentChoices = [
|
|
25
297
|
{ title: "All Components", value: "all", selected: true },
|
|
26
298
|
...components
|
|
@@ -32,7 +304,12 @@ program.command("init").description("Initialize a new Xertica UI project").argum
|
|
|
32
304
|
type: "multiselect",
|
|
33
305
|
name: "components",
|
|
34
306
|
message: "Which components would you like to include?",
|
|
35
|
-
choices: componentChoices
|
|
307
|
+
choices: componentChoices.length > 1 ? componentChoices : [
|
|
308
|
+
{ title: "All Components", value: "all", selected: true }
|
|
309
|
+
// Fetch components logic was above, I'll rely on existing code for that part
|
|
310
|
+
// and just insert my code around existing blocks in separate steps if needed.
|
|
311
|
+
// But replace_file_content requires me to match content.
|
|
312
|
+
],
|
|
36
313
|
hint: "- Space to select. Return to submit",
|
|
37
314
|
min: 1
|
|
38
315
|
},
|
|
@@ -46,6 +323,17 @@ program.command("init").description("Initialize a new Xertica UI project").argum
|
|
|
46
323
|
{ title: "Template Page", value: "template", selected: true }
|
|
47
324
|
]
|
|
48
325
|
},
|
|
326
|
+
{
|
|
327
|
+
type: "select",
|
|
328
|
+
name: "theme",
|
|
329
|
+
message: "Select the default color theme for your project:",
|
|
330
|
+
choices: colorThemes.map((t) => ({
|
|
331
|
+
title: t.name,
|
|
332
|
+
description: t.description,
|
|
333
|
+
value: t.id
|
|
334
|
+
})),
|
|
335
|
+
initial: 0
|
|
336
|
+
},
|
|
49
337
|
{
|
|
50
338
|
type: "confirm",
|
|
51
339
|
name: "install",
|
|
@@ -137,6 +425,17 @@ export default function App() {
|
|
|
137
425
|
});
|
|
138
426
|
}
|
|
139
427
|
}
|
|
428
|
+
if (response.theme) {
|
|
429
|
+
const contextPath = path.join(targetDir, "contexts", "BrandColorsContext.tsx");
|
|
430
|
+
if (await fs.pathExists(contextPath)) {
|
|
431
|
+
let content = await fs.readFile(contextPath, "utf8");
|
|
432
|
+
content = content.replace(
|
|
433
|
+
/return saved \|\| 'xertica-original';/,
|
|
434
|
+
`return saved || '${response.theme}';`
|
|
435
|
+
);
|
|
436
|
+
await fs.writeFile(contextPath, content);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
140
439
|
spinner.succeed("Project initialized successfully!");
|
|
141
440
|
if (response.install) {
|
|
142
441
|
const installSpinner = ora("Installing dependencies...").start();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xertica-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Xertica UI - Design System completo com componentes React e Tailwind CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./dist/cli.js",
|
|
@@ -116,4 +116,4 @@
|
|
|
116
116
|
"typescript": "^5.7.2",
|
|
117
117
|
"vite": "^6.0.5"
|
|
118
118
|
}
|
|
119
|
-
}
|
|
119
|
+
}
|