Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Enumerations | Functions
Ase::AnsiColors Namespace Reference

The AnsiColors namespace contains utility functions for colored terminal output. More...

Enumerations

enum  Colors {
  NONE , RESET , BOLD , BOLD_OFF ,
  ITALICS , ITALICS_OFF , UNDERLINE , UNDERLINE_OFF ,
  INVERSE , INVERSE_OFF , STRIKETHROUGH , STRIKETHROUGH_OFF ,
  FG_BLACK , FG_RED , FG_GREEN , FG_YELLOW ,
  FG_BLUE , FG_MAGENTA , FG_CYAN , FG_WHITE ,
  FG_DEFAULT , BG_BLACK , BG_RED , BG_GREEN ,
  BG_YELLOW , BG_BLUE , BG_MAGENTA , BG_CYAN ,
  BG_WHITE , BG_DEFAULT
}
 ANSI color symbols. More...
 
enum class  Colorize : int8 { NEVER , ALWAYS , AUTO }
 

Functions

void configure (Colorize colorize)
 Override the environment variable $ASE_COLOR (which may contain "always", "never" or "auto").
 
bool colorize_tty (int fd)
 Check whether the tty fd should use colorization, checks ASE_COLOR if fd == -1.
 
std::string color (Colors acolor, Colors c1, Colors c2, Colors c3, Colors c4, Colors c5, Colors c6)
 Return ANSI code for the specified color if stdout & stderr should be colorized, see colorize_tty().
 
const charcolor_code (Colors acolor)
 Return ANSI code for the specified color.
 

Detailed Description

The AnsiColors namespace contains utility functions for colored terminal output.

Enumeration Type Documentation

◆ Colorize

enum class Ase::AnsiColors::Colorize : int8
strong

Definition at line 57 of file platform.hh.

◆ Colors

ANSI color symbols.

Enumerator
RESET 

Reset combines BOLD_OFF, ITALICS_OFF, UNDERLINE_OFF, INVERSE_OFF, STRIKETHROUGH_OFF.

Definition at line 44 of file platform.hh.

Function Documentation

◆ color()

std::string Ase::AnsiColors::color ( Colors  acolor,
Colors  c1,
Colors  c2,
Colors  c3,
Colors  c4,
Colors  c5,
Colors  c6 
)

Return ANSI code for the specified color if stdout & stderr should be colorized, see colorize_tty().

Definition at line 190 of file platform.cc.

References color_code(), colorize_tty(), and return_unless.

◆ color_code()

const char * Ase::AnsiColors::color_code ( Colors  acolor)

Return ANSI code for the specified color.

Definition at line 205 of file platform.cc.

References RESET.

Referenced by color().

◆ colorize_tty()

bool Ase::AnsiColors::colorize_tty ( int  fd)

Check whether the tty fd should use colorization, checks ASE_COLOR if fd == -1.

Definition at line 161 of file platform.cc.

References getenv(), isatty(), return_unless, and strncasecmp().

Referenced by color().

◆ configure()

void Ase::AnsiColors::configure ( Colorize  colorize)

Override the environment variable $ASE_COLOR (which may contain "always", "never" or "auto").

Definition at line 154 of file platform.cc.