8000 feat: improve TW3 color support (#710) · windicss/windicss@67802fe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 67802fe

Browse files
authored
feat: improve TW3 color support (#710)
1 parent 321b2d6 commit 67802fe

File tree

1 file changed

+102
-109
lines changed

1 file changed

+102
-109
lines changed

src/config/colors.ts

Lines changed: 102 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { Console } from '../utils/tools';
22

33
type Colors =
4-
'black'
4+
'inherit'
5+
| 'current'
6+
| 'transparent'
7+
| 'black'
58
| 'white'
69
| 'rose'
710
| 'pink'
@@ -28,6 +31,7 @@ type Colors =
2831
| 'blueGray'
2932
| 'slate'
3033
| 'zink'
34+
| 'zinc'
3135
| 'neutral'
3236
| 'stone'
3337
| 'dark'
@@ -50,9 +54,85 @@ const sky = {
5054
900: '#0c4a6e',
5155
};
5256

57+
const neutral = {
58+
50: '#fafafa',
59+
100: '#f5f5f5',
60+
200: '#e5e5e5',
61+
300: '#d4d4d4',
62+
400: '#a3a3a3',
63+
500: '#737373',
64+
600: '#525252',
65+
700: '#404040',
66+
800: '#262626',
67+
900: '#171717',
68+
};
69+
70+
const stone = {
71+
50: '#fafaf9',
72+
100: '#f5f5f4',
73+
200: '#e7e5e4',
74+
300: '#d6d3d1',
75+
400: '#a8a29e',
76+
500: '#78716c',
77+
600: '#57534e',
78+
700: '#44403c',
79+
800: '#292524',
80+
900: '#1c1917',
81+
};
82+
83+
const slate = {
84+
50: '#f8fafc',
85+
100: '#f1f5f9',
86+
200: '#e2e8f0',
87+
300: '#cbd5e1',
88+
400: '#94A3B8',
89+
500: '#64748B',
90+
600: '#475569',
91+
700: '#334155',
92+
800: '#1E293B',
93+
900: '#0F172A',
94+
};
95+
96+
const zinc = {
97+
50: '#fafafa',
98+
100: '#f4f4f5',
99+
200: '#e4e4e7',
100+
300: '#d4d4d8',
101+
400: '#a1a1aa',
102+
500: '#71717A',
103+
600: '#52525B',
104+
700: '#3F3F46',
105+
800: '#27272A',
106+
900: '#18181B',
107+
};
108+
109+
const gray = {
110+
50: '#f9fafb',
111+
100: '#f3f4f6',
112+
200: '#e5e7eb',
113+
300: '#d1d5db',
114+
400: '#9ca3af',
115+
500: '#6b7280',
116+
600: '#4b5563',
117+
700: '#374151',
118+
800: '#1f2937',
119+
900: '#111827',
120+
};
121+
53122
let warned = false;
54123

124+
function color_warn(from: string, to: string) {
125+
if (!warned) {
126+
Console.log(`warn - '${from}' has been renamed to '${to}'.`);
127+
Console.log('warn - Please update your color palette to eliminate this warning.');
128+
warned = true;
129+
}
130+
}
131+
55132
export const colors: DefaultColors = {
133+
inherit: 'inherit',
134+
current: 'currentColor',
135+
transparent: 'transparent',
56136
black: '#000',
57137
white: '#fff',
58138
rose: {
@@ -141,11 +221,7 @@ export const colors: DefaultColors = {
141221
},
142222
sky,
143223
get lightBlue() {
144-
if (!warned) {
145-
Console.log('warn - `lightBlue` has been renamed to `sky`.');
146-
Console.log('warn - Please update your color palette to eliminate this warning.');
147-
warned = true;
148-
}
224+
color_warn('lightBlue', 'sky');
149225
return sky;
150226
},
151227
cyan: {
@@ -256,114 +332,31 @@ export const colors: DefaultColors = {
256332
800: '#991b1b',
257333
900: '#7f1d1d',
258334
},
259-
warmGray: {
260-
50: '#fafaf9',
261-
100: '#f5f5f4',
262-
200: '#e7e5e4',
263-
300: '#d6d3d1',
264-
400: '#a8a29e',
265-
500: '#78716c',
266-
600: '#57534e',
267-
700: '#44403c',
268-
800: '#292524',
269-
900: '#1c1917',
270-
},
271-
trueGray: {
272-
50: '#fafafa',
273-
100: '#f5f5f5',
274-
200: '#e5e5e5',
275-
300: '#d4d4d4',
276-
400: '#a3a3a3',
277-
500: '#737373',
278-
600: '#525252',
279-
700: '#404040',
280-
800: '#262626',
281-
900: '#171717',
282-
},
283-
gray: {
284-
50: '#fafafa',
285-
100: '#f4f4f5',
286-
200: '#e4e4e7',
287-
300: '#d4d4d8',
288-
400: '#a1a1aa',
289-
500: '#71717a',
290-
600: '#52525b',
291-
700: '#3f3f46',
292-
800: '#27272a',
293-
900: '#18181b',
294-
},
295-
coolGray: {
296-
50: '#f9fafb',
297-
100: '#f3f4f6',
298-
200: '#e5e7eb',
299-
300: '#d1d5db',
300-
400: '#9ca3af',
301-
500: '#6b7280',
302-
600: '#4b5563',
303-
700: '#374151',
304-
800: '#1f2937',
305-
900: '#111827',
306-
},
307-
blueGray: {
308-
50: '#f8fafc',
309-
100: '#f1f5f9',
310-
200: '#e2e8f0',
311-
300: '#cbd5e1',
312-
400: '#94a3b8',
313-
500: '#64748b',
314-
600: '#475569',
315-
700: '#334155',
316-
800: '#1e293b',
317-
900: '#0f172a',
335+
get warmGray() {
336+
color_warn('warmGray', 'stone');
337+
return stone;
318338
},
319-
slate: {
320-
50: '#f8fafc',
321-
100: '#f1f5f9',
322-
200: '#e2e8f0',
323-
300: '#cbd5e1',
324-
400: '#94A3B8',
325-
500: '#64748B',
326-
600: '#475569',
327-
700: '#334155',
328-
800: '#1E293B',
329-
900: '#0F172A',
339+
get trueGray() {
340+
color_warn('trueGray', 'neutral');
341+
return neutral;
330342
},
331-
zink: {
332-
50: '#fafafa',
333-
100: '#f4f4f5',
334-
200: '#e4e4e7',
335-
300: '#d4d4d8',
336-
400: '#a1a1aa',
337-
500: '#71717A',
338-
600: '#52525B',
339-
700: '#3F3F46',
340-
800: '#27272A',
341-
900: '#18181B',
343+
gray,
344+
get coolGray() {
345+
color_warn('coolGray', 'gray');
346+
return gray;
342347
},
343-
neutral: {
344-
50: '#fafafa',
345-
100: '#f5f5f5',
346-
200: '#e5e5e5',
347-
300: '#d4d4d4',
348-
400: '#a3a3a3',
349-
500: '#737373',
350-
600: '#525252',
351-
700: '#404040',
352-
800: '#262626',
353-
900: '#171717',
348+
get blueGray() {
349+
color_warn('blueGray', 'slate');
350+
return slate;
354351
},
355-
stone: {
356-
50: '#fafaf9',
357-
100: '#f5f5f4',
358-
200: '#e7e5e4',
359-
300: '#d6d3d1',
360-
400: '#a8a29e',
361-
500: '#78716C',
362-
600: '#57534E',
363-
700: '#44403C',
364-
800: '#292524',
365-
900: '#1C1917',
352+
slate,
353+
zinc,
354+
get zink() {
355+
color_warn('zink', 'zinc');
356+
return zinc;
366357
},
358+
neutral,
359+
stone,
367360
light: {
368361
50: '#fdfdfd',
369362
100: '#fcfcfc',

0 commit comments

Comments
 (0)
0