feat(ui): add solid background color option for input prompt (#16563)

Co-authored-by: Alexander Farber <farber72@outlook.de>
This commit is contained in:
Jacob Richman
2026-01-26 15:23:54 -08:00
committed by GitHub
parent 7fbf470373
commit b5fe372b5b
40 changed files with 898 additions and 420 deletions

View File

@@ -233,6 +233,33 @@ export function resolveColor(colorValue: string): string | undefined {
return undefined;
}
/**
* Returns a "safe" background color to use in low-color terminals if the
* terminal background is a standard black or white.
* Returns undefined if no safe background color is available for the given
* terminal background.
*/
export function getSafeLowColorBackground(
terminalBg: string,
): string | undefined {
const resolvedTerminalBg = resolveColor(terminalBg) || terminalBg;
if (
resolvedTerminalBg === 'black' ||
resolvedTerminalBg === '#000000' ||
resolvedTerminalBg === '#000'
) {
return '#1c1c1c';
}
if (
resolvedTerminalBg === 'white' ||
resolvedTerminalBg === '#ffffff' ||
resolvedTerminalBg === '#fff'
) {
return '#eeeeee';
}
return undefined;
}
export function interpolateColor(
color1: string,
color2: string,