mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 18:24:21 +01:00
chore: normalize theme hex
This commit is contained in:
@@ -35,18 +35,19 @@ class ColorResolver {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
if (value.startsWith("#") || value === "none") {
|
if (value === "none") return { dark: value, light: value }
|
||||||
return { dark: value, light: value }
|
if (value.startsWith("#")) {
|
||||||
|
return { dark: value.toUpperCase(), light: value.toUpperCase() }
|
||||||
}
|
}
|
||||||
const resolved = this.resolveReference(value)
|
const resolved = this.resolveReference(value)
|
||||||
return { dark: resolved, light: resolved }
|
return { dark: resolved, light: resolved }
|
||||||
}
|
}
|
||||||
if (typeof value === "object" && value !== null) {
|
if (typeof value === "object" && value !== null) {
|
||||||
const dark = this.resolveColorValue(value.dark || value.light || "#000000")
|
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, light }
|
||||||
}
|
}
|
||||||
return { dark: "#000000", light: "#ffffff" }
|
return { dark: "#000000", light: "#FFFFFF" }
|
||||||
} finally {
|
} finally {
|
||||||
this.visited.delete(key)
|
this.visited.delete(key)
|
||||||
}
|
}
|
||||||
@@ -54,8 +55,9 @@ class ColorResolver {
|
|||||||
|
|
||||||
private resolveColorValue(value: any): string {
|
private resolveColorValue(value: any): string {
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
if (value.startsWith("#") || value === "none") {
|
if (value === "none") return value
|
||||||
return value
|
if (value.startsWith("#")) {
|
||||||
|
return value.toUpperCase()
|
||||||
}
|
}
|
||||||
return this.resolveReference(value)
|
return this.resolveReference(value)
|
||||||
}
|
}
|
||||||
@@ -68,8 +70,9 @@ class ColorResolver {
|
|||||||
throw new Error(`Color reference '${ref}' not found`)
|
throw new Error(`Color reference '${ref}' not found`)
|
||||||
}
|
}
|
||||||
if (typeof colorValue === "string") {
|
if (typeof colorValue === "string") {
|
||||||
if (colorValue.startsWith("#") || colorValue === "none") {
|
if (colorValue === "none") return colorValue
|
||||||
return colorValue
|
if (colorValue.startsWith("#")) {
|
||||||
|
return colorValue.toUpperCase()
|
||||||
}
|
}
|
||||||
return this.resolveReference(colorValue)
|
return this.resolveReference(colorValue)
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user