Skip to content

Instantly share code, notes, and snippets.

@jhurliman
Last active February 8, 2020 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhurliman/851b93b49a01c4f84b888fe647a2b37f to your computer and use it in GitHub Desktop.
Save jhurliman/851b93b49a01c4f84b888fe647a2b37f to your computer and use it in GitHub Desktop.
COLOR macro for C/C++ ANSI color code printing
// Assumes the surrounding context has a bool named `color`
#define COLOR( code, s ) ( color ? "\033[0;" #code "m" : "" ) << s << ( color ? "\033[0;m" : "" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment