summaryrefslogtreecommitdiffhomepage
path: root/packages/css/script/colors.ts
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-10-16 14:01:49 -0500
committerAdam <[email protected]>2025-10-16 14:07:37 -0500
commit20229f147bbe5e096e1863391246eaaa798f40ce (patch)
tree2946240638555779eb5e3e3148fc29bae6ab37e4 /packages/css/script/colors.ts
parent149cb6a9ec2a03db70332218f970be4f25ee5ba9 (diff)
downloadopencode-20229f147bbe5e096e1863391246eaaa798f40ce.tar.gz
opencode-20229f147bbe5e096e1863391246eaaa798f40ce.zip
wip: css/ui and desktop work
Diffstat (limited to 'packages/css/script/colors.ts')
-rw-r--r--packages/css/script/colors.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/css/script/colors.ts b/packages/css/script/colors.ts
new file mode 100644
index 000000000..b4f1e7f00
--- /dev/null
+++ b/packages/css/script/colors.ts
@@ -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())