Celeritas 0.7.0-dev.277+develop.2401d1ca
Loading...
Searching...
No Matches
Functions
ColorUtils.hh File Reference

Helper functions for writing colors to the terminal. More...

#include "corecel/Macros.hh"

Functions

bool celeritas::use_color ()
 Whether colors are enabled by the environment.
 
char constceleritas::ansi_color (char abbrev)
 Get an ANSI color codes if colors are enabled.
 
char constceleritas::color_code (char abbrev)
 

Detailed Description

Helper functions for writing colors to the terminal.

Function Documentation

◆ ansi_color()

char const * celeritas::ansi_color ( char  abbrev)

Get an ANSI color codes if colors are enabled.

  • [b]lue
  • [g]reen
  • [y]ellow
  • [r]ed
  • [x] gray
  • [R]ed bold
  • [W]hite bold
  • null reset color
  • [ ] reset color

◆ use_color()

bool celeritas::use_color ( )

Whether colors are enabled by the environment.

The NO_COLOR environment variable, if set to a non-empty value, disables color output. If either of the CELER_COLOR or GTEST_COLOR variables is set, that value will be used. Failing that, the default is true if stderr is a tty. The result of this value is used by ansi_color .