Compose an ANSI SGR sequence

SolidGroundUX DocumentationSolidGroundUX
NL

fn: sgnd_sgr

Purpose

Compose one ANSI Select Graphic Rendition sequence from supplied parameters.

Behavior

  • Ignore empty tokens and unsupported token forms.
  • Accept semicolon/comma lists and extract numeric parameters from SGR sequences.
  • Return RESET when no valid parameters remain.

Arguments

  • $@ — Numeric SGR values, lists of numeric values, or ANSI SGR sequences.

Inputs (globals)

RESET for the no-parameter case.

Output

Writes the escape sequence without a newline.

Returns

Exit status of printf.

Usage

  bold_blue="$(sgnd_sgr "$BRIGHT_BLUE" "$FX_BOLD")"