mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
wip: css/ui and desktop work
This commit is contained in:
31
packages/css/script/colors.ts
Normal file
31
packages/css/script/colors.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
// read lines from colors.txt
|
||||
// parse each line into a color name and hex value
|
||||
// create a css variable for each color
|
||||
// NOTE: only use Bun file APIs here
|
||||
|
||||
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/colors.ts */
|
||||
/* Do not edit this file manually */
|
||||
|
||||
@theme {
|
||||
--color-*: initial;
|
||||
${variables.join("\n ")}
|
||||
}
|
||||
`
|
||||
|
||||
// write to src/tailwind-colors.css
|
||||
Bun.file(import.meta.dir + "/../src/tailwind-colors.css").write(output.trim())
|
||||
|
||||
// Bun.file(import.meta.dir + "../src/tailwind-colors.css").write(output.trim())
|
||||
Reference in New Issue
Block a user