tty-supports-256color? ( -- ? )
Formatted TTY Output

Prev:tty-supports-ansicolor? ( -- ? )
Next:tty-supports-rgbcolor? ( -- ? )


Vocabulary
terminfo

Inputs
None

Outputs
?a boolean


Word description
Outputs t if the current terminal (based on $TERM) supports 256-color output. This is an indexed mode, consisting of the ANSI and AIXterm palettes in indexes 0-15 (see tty-supports-ansicolor?), an RGB colour cube in indexes 16-231, and a 24-step greyscale ramp in indexes 232-255.

If $NO_COLOR is set, unconditionally returns f regardless of the terminal's underlying capabilities.

Foreground colour is selected using the sequence SGR 38:5:c, and background colour with SGR 48:5:c, where c is the colour index.

Caveats
The standard documents : as the separator between arguments to these SGRs. Some terminals support ; as well, for backwards compatibility with older, non-standards-compliant software; a few insist on ; and will not understand :. Consult the "set_a_foreground" and "set_a_background" terminfo capabilities to be sure. If you're winging it, prefer :.

See also
tty-supports-attributes?, tty-supports-ansicolor?, tty-supports-rgbcolor?, Terminfo Databases

Definition