Speclib  0.1.2
The library for writing better CUDA libraries
ANSI Colour Codes

ANSI colour codes, because every library eventually grows to the point of needing colour logging. More...

Classes

struct  sp::fmt
 Formatting (bold, underline, etc.) More...
 
struct  sp::fg
 Foreground colours. More...
 
struct  sp::bg
 Background colours. More...
 

Macros

#define FMT_FUNC_(DOC_NAME, NAME, ON, OFF)
 
#define FMT_FUNC(NAME, ON, OFF)   FMT_FUNC_(NAME, NAME, ON, OFF)
 
#define FG_COLOUR(NAME, ON)   FMT_FUNC_(foreground, NAME, ON, 39)
 
#define BG_COLOUR(NAME, ON)   FMT_FUNC_(background, NAME, ON, 49)
 

Detailed Description

ANSI colour codes, because every library eventually grows to the point of needing colour logging.

Harvested from here: https://misc.flogisoft.com/bash/tip_colors_and_formatting

Macro Definition Documentation

◆ FMT_FUNC_

#define FMT_FUNC_ (   DOC_NAME,
  NAME,
  ON,
  OFF 
)
Value:
\
static inline std::string NAME() { \
return "\x1b[" #ON "m"; \
} \
\ \
static inline std::string NAME ## Off() { \
return "\x1b[" #OFF "m"; \
} \
\ \
template<typename T> \
[[nodiscard]] static inline std::string NAME(T wrap) { \
std::stringstream ss; \
ss << wrap; \
return NAME() + ss.str() + NAME ## Off(); \
}