Skip to content

Commit 906f430

Browse files
committed
split colors in gray and accent
1 parent 9228cfe commit 906f430

35 files changed

Lines changed: 67 additions & 102 deletions

registry.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ const resolveRecipe = async (fileName: string) => {
7979
const generateColors = async () => {
8080
const glob = new Glob('./packages/preset/src/colors/*.ts')
8181

82-
const index: { id: string }[] = []
82+
const grayColors = ['neutral', 'mauve', 'olive', 'sage', 'sand', 'slate']
83+
84+
const grayIndex: { id: string }[] = []
85+
const accentIndex: { id: string }[] = []
8386

8487
for await (const path of glob.scan('.')) {
8588
const file = Bun.file(path)
@@ -89,6 +92,8 @@ const generateColors = async () => {
8992
const fileName = `./colors/${parse(file.name).base}`
9093
const content = await file.text()
9194

95+
const type = grayColors.includes(id) ? 'gray' : 'accent'
96+
9297
const files = [
9398
{
9499
type: 'theme',
@@ -97,12 +102,18 @@ const generateColors = async () => {
97102
},
98103
]
99104

100-
index.push({
101-
id,
102-
})
105+
if (type === 'gray') {
106+
grayIndex.push({
107+
id,
108+
})
109+
} else {
110+
accentIndex.push({
111+
id,
112+
})
113+
}
103114

104115
Bun.write(
105-
`./website/public/registry/theme/colors/${id}.json`,
116+
`./website/public/registry/theme/colors/${type}/${id}.json`,
106117
JSON.stringify(
107118
{
108119
$schema: 'https://next.park-ui.com/schema/registry-item.json',
@@ -137,9 +148,18 @@ const generateColors = async () => {
137148
}
138149

139150
Bun.write(
140-
`./website/public/registry/theme/colors/index.json`,
151+
`./website/public/registry/theme/colors/gray/index.json`,
152+
JSON.stringify(
153+
grayIndex.sort((a, b) => a.id.localeCompare(b.id)),
154+
null,
155+
2,
156+
),
157+
)
158+
159+
Bun.write(
160+
`./website/public/registry/theme/colors/accent/index.json`,
141161
JSON.stringify(
142-
index.sort((a, b) => a.id.localeCompare(b.id)),
162+
grayIndex.sort((a, b) => a.id.localeCompare(b.id)),
143163
null,
144164
2,
145165
),
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)