CPGen
C++ project generator
Loading...
Searching...
No Matches
Functions
Utils::Colours Namespace Reference

ANSI SGR (Select Graphic Rendition) code constants and escape sequence builder. More...

Functions

std::string esc (const char *code)
 Build a complete ANSI SGR escape sequence from a code string.
 

Variables

Standard foreground colours
constexpr const char * FG_BLACK = "30"
 Black foreground.
 
constexpr const char * FG_RED = "31"
 Red foreground.
 
constexpr const char * FG_GREEN = "32"
 Green foreground.
 
constexpr const char * FG_YELLOW = "33"
 Yellow foreground.
 
constexpr const char * FG_BLUE = "34"
 Blue foreground.
 
constexpr const char * FG_MAGENTA = "35"
 Magenta foreground.
 
constexpr const char * FG_CYAN = "36"
 Cyan foreground.
 
constexpr const char * FG_WHITE = "37"
 White foreground.
 
Bright / light foreground colours
constexpr const char * FG_BBLACK
 Bright black (dark grey) foreground.
 
constexpr const char * FG_BRED = "91"
 Bright red foreground.
 
constexpr const char * FG_BGREEN = "92"
 Bright green foreground.
 
constexpr const char * FG_BYELLOW = "93"
 Bright yellow foreground.
 
constexpr const char * FG_BBLUE = "94"
 Bright blue foreground.
 
constexpr const char * FG_BMAGENTA = "95"
 Bright magenta foreground.
 
constexpr const char * FG_BCYAN = "96"
 Bright cyan foreground.
 
constexpr const char * FG_BWHITE = "97"
 Bright white foreground.
 
Standard background colours
constexpr const char * BG_BLACK = "40"
 Black background.
 
constexpr const char * BG_RED = "41"
 Red background.
 
constexpr const char * BG_GREEN = "42"
 Green background.
 
constexpr const char * BG_YELLOW = "43"
 Yellow background.
 
constexpr const char * BG_BLUE = "44"
 Blue background.
 
constexpr const char * BG_MAGENTA = "45"
 Magenta background.
 
constexpr const char * BG_CYAN = "46"
 Cyan background.
 
constexpr const char * BG_WHITE = "47"
 White background.
 
Bright / light background colours
constexpr const char * BG_BBLACK = "100"
 Bright black background.
 
constexpr const char * BG_BRED = "101"
 Bright red background.
 
constexpr const char * BG_BGREEN = "102"
 Bright green background.
 
constexpr const char * BG_BYELLOW = "103"
 Bright yellow background.
 
constexpr const char * BG_BBLUE = "104"
 Bright blue background.
 
constexpr const char * BG_BMAGENTA
 Bright magenta background.
 
constexpr const char * BG_BCYAN = "106"
 Bright cyan background.
 
constexpr const char * BG_BWHITE = "107"
 Bright white background.
 
Text style modifiers
constexpr const char * RESET = "0"
 Reset all attributes.
 
constexpr const char * BOLD = "1"
 Bold / increased intensity.
 
constexpr const char * DIM = "2"
 Dim / decreased intensity.
 
constexpr const char * ITALIC = "3"
 Italic.
 
constexpr const char * UNDERLINE = "4"
 Underline.
 
constexpr const char * BLINK = "5"
 Slow blink.
 
constexpr const char * INVERSE = "7"
 Reverse video (swap FG/BG).
 
constexpr const char * HIDDEN = "8"
 Conceal / invisible.
 
constexpr const char * STRIKETHRU = "9"
 Strikethrough.
 

Detailed Description

ANSI SGR (Select Graphic Rendition) code constants and escape sequence builder.

Each constant is the numeric SGR parameter string (without the surrounding ESC[…m). Pass them to esc to get a ready-to-print escape sequence.

Function Documentation

◆ esc()

std::string Utils::Colours::esc ( const char *  code)
inline

Build a complete ANSI SGR escape sequence from a code string.

Wraps code in the standard ESC [ … m envelope so it can be embedded directly in output strings.

Parameters
codeAn SGR parameter string such as FG_GREEN or BOLD.
Returns
A ready-to-print ANSI escape sequence (e.g. "\\033[32m").
Here is the caller graph for this function:

Variable Documentation

◆ BG_BBLACK

constexpr const char* Utils::Colours::BG_BBLACK = "100"
inlineconstexpr

Bright black background.

◆ BG_BBLUE

constexpr const char* Utils::Colours::BG_BBLUE = "104"
inlineconstexpr

Bright blue background.

◆ BG_BCYAN

constexpr const char* Utils::Colours::BG_BCYAN = "106"
inlineconstexpr

Bright cyan background.

◆ BG_BGREEN

constexpr const char* Utils::Colours::BG_BGREEN = "102"
inlineconstexpr

Bright green background.

◆ BG_BLACK

constexpr const char* Utils::Colours::BG_BLACK = "40"
inlineconstexpr

Black background.

◆ BG_BLUE

constexpr const char* Utils::Colours::BG_BLUE = "44"
inlineconstexpr

Blue background.

◆ BG_BMAGENTA

constexpr const char* Utils::Colours::BG_BMAGENTA
inlineconstexpr
Initial value:
=
"105"

Bright magenta background.

◆ BG_BRED

constexpr const char* Utils::Colours::BG_BRED = "101"
inlineconstexpr

Bright red background.

◆ BG_BWHITE

constexpr const char* Utils::Colours::BG_BWHITE = "107"
inlineconstexpr

Bright white background.

◆ BG_BYELLOW

constexpr const char* Utils::Colours::BG_BYELLOW = "103"
inlineconstexpr

Bright yellow background.

◆ BG_CYAN

constexpr const char* Utils::Colours::BG_CYAN = "46"
inlineconstexpr

Cyan background.

◆ BG_GREEN

constexpr const char* Utils::Colours::BG_GREEN = "42"
inlineconstexpr

Green background.

◆ BG_MAGENTA

constexpr const char* Utils::Colours::BG_MAGENTA = "45"
inlineconstexpr

Magenta background.

◆ BG_RED

constexpr const char* Utils::Colours::BG_RED = "41"
inlineconstexpr

Red background.

◆ BG_WHITE

constexpr const char* Utils::Colours::BG_WHITE = "47"
inlineconstexpr

White background.

◆ BG_YELLOW

constexpr const char* Utils::Colours::BG_YELLOW = "43"
inlineconstexpr

Yellow background.

◆ BLINK

constexpr const char* Utils::Colours::BLINK = "5"
inlineconstexpr

Slow blink.

◆ BOLD

constexpr const char* Utils::Colours::BOLD = "1"
inlineconstexpr

Bold / increased intensity.

◆ DIM

constexpr const char* Utils::Colours::DIM = "2"
inlineconstexpr

Dim / decreased intensity.

◆ FG_BBLACK

constexpr const char* Utils::Colours::FG_BBLACK
inlineconstexpr
Initial value:
=
"90"

Bright black (dark grey) foreground.

◆ FG_BBLUE

constexpr const char* Utils::Colours::FG_BBLUE = "94"
inlineconstexpr

Bright blue foreground.

◆ FG_BCYAN

constexpr const char* Utils::Colours::FG_BCYAN = "96"
inlineconstexpr

Bright cyan foreground.

◆ FG_BGREEN

constexpr const char* Utils::Colours::FG_BGREEN = "92"
inlineconstexpr

Bright green foreground.

◆ FG_BLACK

constexpr const char* Utils::Colours::FG_BLACK = "30"
inlineconstexpr

Black foreground.

◆ FG_BLUE

constexpr const char* Utils::Colours::FG_BLUE = "34"
inlineconstexpr

Blue foreground.

◆ FG_BMAGENTA

constexpr const char* Utils::Colours::FG_BMAGENTA = "95"
inlineconstexpr

Bright magenta foreground.

◆ FG_BRED

constexpr const char* Utils::Colours::FG_BRED = "91"
inlineconstexpr

Bright red foreground.

◆ FG_BWHITE

constexpr const char* Utils::Colours::FG_BWHITE = "97"
inlineconstexpr

Bright white foreground.

◆ FG_BYELLOW

constexpr const char* Utils::Colours::FG_BYELLOW = "93"
inlineconstexpr

Bright yellow foreground.

◆ FG_CYAN

constexpr const char* Utils::Colours::FG_CYAN = "36"
inlineconstexpr

Cyan foreground.

◆ FG_GREEN

constexpr const char* Utils::Colours::FG_GREEN = "32"
inlineconstexpr

Green foreground.

◆ FG_MAGENTA

constexpr const char* Utils::Colours::FG_MAGENTA = "35"
inlineconstexpr

Magenta foreground.

◆ FG_RED

constexpr const char* Utils::Colours::FG_RED = "31"
inlineconstexpr

Red foreground.

◆ FG_WHITE

constexpr const char* Utils::Colours::FG_WHITE = "37"
inlineconstexpr

White foreground.

◆ FG_YELLOW

constexpr const char* Utils::Colours::FG_YELLOW = "33"
inlineconstexpr

Yellow foreground.

◆ HIDDEN

constexpr const char* Utils::Colours::HIDDEN = "8"
inlineconstexpr

Conceal / invisible.

◆ INVERSE

constexpr const char* Utils::Colours::INVERSE = "7"
inlineconstexpr

Reverse video (swap FG/BG).

◆ ITALIC

constexpr const char* Utils::Colours::ITALIC = "3"
inlineconstexpr

Italic.

◆ RESET

constexpr const char* Utils::Colours::RESET = "0"
inlineconstexpr

Reset all attributes.

◆ STRIKETHRU

constexpr const char* Utils::Colours::STRIKETHRU = "9"
inlineconstexpr

Strikethrough.

◆ UNDERLINE

constexpr const char* Utils::Colours::UNDERLINE = "4"
inlineconstexpr

Underline.