-
Notifications
You must be signed in to change notification settings - Fork 493
Support ANSI 16 color codes for borderColor and backgroundColor #852
Description
Problem
Currently, borderColor and backgroundColor on BoxRenderable are rendered using true color escape sequences (\e[38;2;r;g;bm). This means the colors are absolute RGB values that don't adapt to the user's terminal color scheme.
ANSI 16 color codes (\e[31m, \e[41m, etc.) are mapped by the terminal emulator to its configured palette, so an app can automatically adapt to the user's theme — especially important over SSH where the client terminal defines the colors.
Current behavior
fg()styled text supports ANSI named colors viared(),blue(),cyan()etc.borderColorandbackgroundColoracceptColorInputbut always render as true color, even when a named color like"red"is passed —parseColorconverts it to a fixed RGB value (rgba(1,0,0))
Expected behavior
When a named ANSI color (e.g. "red", "blue", "brightCyan") is used as borderColor or backgroundColor, it should emit the corresponding ANSI 16 escape code instead of a true color sequence, so the terminal can map it to its palette.
Use case
Building a TUI app that respects the user's terminal theme out of the box, without requiring manual color configuration. This is standard behavior in tools like lazygit and other popular terminal apps.