Skip to content

Documentation / @ripl/terminal / colorToAnsiBg

Function: colorToAnsiBg() ​

colorToAnsiBg(color, opacity?): string | undefined

Defined in: terminal/src/color.ts:152

Converts a CSS color string to an ANSI truecolor background escape sequence. Resolution and return values match colorToAnsiFg.

Parameters ​

ParameterTypeDefault valueDescription
colorstringundefinedThe paint to resolve.
opacitynumber1Additional alpha to composite over the paint's own. Defaults to 1.

Returns ​

string | undefined

The escape sequence, '' when unresolvable, or undefined when it must not be drawn.