summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/script/tailwind.ts
blob: 6e558a8fa11cc024b71d2e311f4d27ebc89c0cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bun

const colors = await Bun.file(import.meta.dir + "/colors.txt").text()

const variables = []
for (const line of colors.split("\n")) {
  if (!line.trim()) continue
  const [variable] = line.trim().split(":")
  const name = variable!.trim().substring(2)
  variables.push(`--color-${name}: var(--${name});`)
}

const output = `
/* Generated by script/tailwind.ts */
/* Do not edit this file manually */

@theme {
  --color-*: initial;
  ${variables.join("\n  ")}
}
`

await Bun.file(import.meta.dir + "/../src/styles/tailwind/colors.css").write(output.trim())