@brimveyn/aimux-config 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tui/resolve.ts +8 -9
package/package.json
CHANGED
package/src/tui/resolve.ts
CHANGED
|
@@ -102,15 +102,14 @@ function resolveColorRgba(
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function rgbaToCss(c: RGBA): string {
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
return `rgba(${r}, ${g}, ${b}, ${(a / 255).toFixed(3)})`
|
|
105
|
+
const clamp = (v: number) => Math.max(0, Math.min(255, Math.round(v)))
|
|
106
|
+
const hex = (v: number) => clamp(v).toString(16).padStart(2, '0')
|
|
107
|
+
const r = hex(c.r)
|
|
108
|
+
const g = hex(c.g)
|
|
109
|
+
const b = hex(c.b)
|
|
110
|
+
// opentui only parses hex strings (#rrggbb / #rrggbbaa) — `rgba(...)` falls
|
|
111
|
+
// back to magenta. Always emit hex; append alpha byte when not fully opaque.
|
|
112
|
+
return clamp(c.a) === 255 ? `#${r}${g}${b}` : `#${r}${g}${b}${hex(c.a)}`
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
/**
|