diff options
| author | Adam <[email protected]> | 2025-09-19 09:32:19 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-09-19 09:32:19 -0500 |
| commit | ba839d4446a88fad7626a72f84e51f0bab39741b (patch) | |
| tree | c4ddd616bbc88aa2f045a4743012bc16bf96ac14 /packages/app/scripts | |
| parent | 2bec21d81dbf6202a391a881e35cba2a068be784 (diff) | |
| download | opencode-ba839d4446a88fad7626a72f84e51f0bab39741b.tar.gz opencode-ba839d4446a88fad7626a72f84e51f0bab39741b.zip | |
chore: normalize theme hex
Diffstat (limited to 'packages/app/scripts')
| -rw-r--r-- | packages/app/scripts/vite-theme-plugin.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/packages/app/scripts/vite-theme-plugin.ts b/packages/app/scripts/vite-theme-plugin.ts index 31881044e..2d9cc9449 100644 --- a/packages/app/scripts/vite-theme-plugin.ts +++ b/packages/app/scripts/vite-theme-plugin.ts @@ -35,18 +35,19 @@ class ColorResolver { try { if (typeof value === "string") { - if (value.startsWith("#") || value === "none") { - return { dark: value, light: value } + if (value === "none") return { dark: value, light: value } + if (value.startsWith("#")) { + return { dark: value.toUpperCase(), light: value.toUpperCase() } } const resolved = this.resolveReference(value) return { dark: resolved, light: resolved } } if (typeof value === "object" && value !== null) { const dark = this.resolveColorValue(value.dark || value.light || "#000000") - const light = this.resolveColorValue(value.light || value.dark || "#ffffff") + const light = this.resolveColorValue(value.light || value.dark || "#FFFFFF") return { dark, light } } - return { dark: "#000000", light: "#ffffff" } + return { dark: "#000000", light: "#FFFFFF" } } finally { this.visited.delete(key) } @@ -54,8 +55,9 @@ class ColorResolver { private resolveColorValue(value: any): string { if (typeof value === "string") { - if (value.startsWith("#") || value === "none") { - return value + if (value === "none") return value + if (value.startsWith("#")) { + return value.toUpperCase() } return this.resolveReference(value) } @@ -68,8 +70,9 @@ class ColorResolver { throw new Error(`Color reference '${ref}' not found`) } if (typeof colorValue === "string") { - if (colorValue.startsWith("#") || colorValue === "none") { - return colorValue + if (colorValue === "none") return colorValue + if (colorValue.startsWith("#")) { + return colorValue.toUpperCase() } return this.resolveReference(colorValue) } |
