PRISMS-PF Manual
Loading...
Searching...
No Matches
TerminalColor Class Reference

#include <terminal.h>

Public Member Functions

 TerminalColor ()=delete
 

Static Public Member Functions

static std::string colorize (const StringLike auto &text, std::string_view code)
 Wrap text in a single style.
 
static std::string colorize (const StringLike auto &text, std::initializer_list< std::string_view > codes)
 Wrap text in multiple styles.
 
template<typename... Codes>
requires (std::convertible_to<Codes, std::string_view> && ...)
static std::string colorize (const StringLike auto &text, Codes &&...codes)
 Wrap text in multiple styles.
 
static std::string tessellate (const StringLike auto &text, std::initializer_list< std::string_view > codes, std::size_t block_size=1, std::string_view modifier="")
 Tessellate text with given styles.
 
template<typename... Codes>
requires (std::convertible_to<Codes, std::string_view> && ...)
static std::string tessellate (const StringLike auto &text, std::size_t block_size, std::string_view modifier, Codes &&...codes)
 Tessellate text with given styles.
 
static bool is_supported () noexcept
 Whether terminal supports ANSI codes.
 

Static Public Attributes

static constexpr std::string_view RESET = "\033[0m"
 
static constexpr std::string_view ERASE_SCREEN = "\033[2J"
 
static constexpr std::string_view BOLD = "\033[1m"
 
static constexpr std::string_view DIM = "\033[2m"
 
static constexpr std::string_view ITALIC = "\033[3m"
 
static constexpr std::string_view UNDERLINE = "\033[4m"
 
static constexpr std::string_view BLINK = "\033[5m"
 
static constexpr std::string_view STRIKE = "\033[9m"
 
static constexpr std::string_view BLACK = "\033[30m"
 
static constexpr std::string_view RED = "\033[31m"
 
static constexpr std::string_view GREEN = "\033[32m"
 
static constexpr std::string_view YELLOW = "\033[33m"
 
static constexpr std::string_view BLUE = "\033[34m"
 
static constexpr std::string_view MAGENTA = "\033[35m"
 
static constexpr std::string_view CYAN = "\033[36m"
 
static constexpr std::string_view WHITE = "\033[37m"
 
static constexpr std::string_view DEFAULT = "\033[39m"
 
static constexpr std::string_view BRIGHT_BLACK = "\033[90m"
 
static constexpr std::string_view BRIGHT_RED = "\033[91m"
 
static constexpr std::string_view BRIGHT_GREEN = "\033[92m"
 
static constexpr std::string_view BRIGHT_YELLOW = "\033[93m"
 
static constexpr std::string_view BRIGHT_BLUE = "\033[94m"
 
static constexpr std::string_view BRIGHT_MAGENTA = "\033[95m"
 
static constexpr std::string_view BRIGHT_CYAN = "\033[96m"
 
static constexpr std::string_view BRIGHT_WHITE = "\033[97m"
 
static constexpr std::string_view BG_BLACK = "\033[40m"
 
static constexpr std::string_view BG_RED = "\033[41m"
 
static constexpr std::string_view BG_GREEN = "\033[42m"
 
static constexpr std::string_view BG_YELLOW = "\033[43m"
 
static constexpr std::string_view BG_BLUE = "\033[44m"
 
static constexpr std::string_view BG_MAGENTA = "\033[45m"
 
static constexpr std::string_view BG_CYAN = "\033[46m"
 
static constexpr std::string_view BG_WHITE = "\033[47m"
 
static constexpr std::string_view BG_DEFAULT = "\033[49m"
 
static constexpr std::string_view BG_BRIGHT_BLACK = "\033[100m"
 
static constexpr std::string_view BG_BRIGHT_RED = "\033[101m"
 
static constexpr std::string_view BG_BRIGHT_GREEN = "\033[102m"
 
static constexpr std::string_view BG_BRIGHT_YELLOW = "\033[103m"
 
static constexpr std::string_view BG_BRIGHT_BLUE = "\033[104m"
 
static constexpr std::string_view BG_BRIGHT_MAGENTA = "\033[105m"
 
static constexpr std::string_view BG_BRIGHT_CYAN = "\033[106m"
 
static constexpr std::string_view BG_BRIGHT_WHITE = "\033[107m"
 
static constexpr std::string_view MY_ORANGE = "\033[38;5;166m"
 
static constexpr std::string_view MY_PURPLE = "\033[38;5;91m"
 
static constexpr std::string_view MY_BLUE = "\033[38;5;33m"
 
static constexpr std::string_view MY_GRAY = "\033[38;5;240m"
 

Static Private Member Functions

static std::string tessellate_impl (std::string_view text, std::span< const std::string_view > codes, std::size_t block_size, std::string_view modifier="")
 

Constructor & Destructor Documentation

◆ TerminalColor()

TerminalColor::TerminalColor ( )
delete

Member Function Documentation

◆ colorize() [1/3]

template<typename... Codes>
requires (std::convertible_to<Codes, std::string_view> && ...)
static std::string TerminalColor::colorize ( const StringLike auto & text,
Codes &&... codes )
inlinestatic

Wrap text in multiple styles.

◆ colorize() [2/3]

static std::string TerminalColor::colorize ( const StringLike auto & text,
std::initializer_list< std::string_view > codes )
inlinestatic

Wrap text in multiple styles.

◆ colorize() [3/3]

static std::string TerminalColor::colorize ( const StringLike auto & text,
std::string_view code )
inlinestatic

Wrap text in a single style.

◆ is_supported()

static bool TerminalColor::is_supported ( )
inlinestaticnodiscardnoexcept

Whether terminal supports ANSI codes.

◆ tessellate() [1/2]

static std::string TerminalColor::tessellate ( const StringLike auto & text,
std::initializer_list< std::string_view > codes,
std::size_t block_size = 1,
std::string_view modifier = "" )
inlinestatic

Tessellate text with given styles.

◆ tessellate() [2/2]

template<typename... Codes>
requires (std::convertible_to<Codes, std::string_view> && ...)
static std::string TerminalColor::tessellate ( const StringLike auto & text,
std::size_t block_size,
std::string_view modifier,
Codes &&... codes )
inlinestatic

Tessellate text with given styles.

◆ tessellate_impl()

static std::string TerminalColor::tessellate_impl ( std::string_view text,
std::span< const std::string_view > codes,
std::size_t block_size,
std::string_view modifier = "" )
inlinestaticprivate

Member Data Documentation

◆ BG_BLACK

std::string_view TerminalColor::BG_BLACK = "\033[40m"
staticconstexpr

◆ BG_BLUE

std::string_view TerminalColor::BG_BLUE = "\033[44m"
staticconstexpr

◆ BG_BRIGHT_BLACK

std::string_view TerminalColor::BG_BRIGHT_BLACK = "\033[100m"
staticconstexpr

◆ BG_BRIGHT_BLUE

std::string_view TerminalColor::BG_BRIGHT_BLUE = "\033[104m"
staticconstexpr

◆ BG_BRIGHT_CYAN

std::string_view TerminalColor::BG_BRIGHT_CYAN = "\033[106m"
staticconstexpr

◆ BG_BRIGHT_GREEN

std::string_view TerminalColor::BG_BRIGHT_GREEN = "\033[102m"
staticconstexpr

◆ BG_BRIGHT_MAGENTA

std::string_view TerminalColor::BG_BRIGHT_MAGENTA = "\033[105m"
staticconstexpr

◆ BG_BRIGHT_RED

std::string_view TerminalColor::BG_BRIGHT_RED = "\033[101m"
staticconstexpr

◆ BG_BRIGHT_WHITE

std::string_view TerminalColor::BG_BRIGHT_WHITE = "\033[107m"
staticconstexpr

◆ BG_BRIGHT_YELLOW

std::string_view TerminalColor::BG_BRIGHT_YELLOW = "\033[103m"
staticconstexpr

◆ BG_CYAN

std::string_view TerminalColor::BG_CYAN = "\033[46m"
staticconstexpr

◆ BG_DEFAULT

std::string_view TerminalColor::BG_DEFAULT = "\033[49m"
staticconstexpr

◆ BG_GREEN

std::string_view TerminalColor::BG_GREEN = "\033[42m"
staticconstexpr

◆ BG_MAGENTA

std::string_view TerminalColor::BG_MAGENTA = "\033[45m"
staticconstexpr

◆ BG_RED

std::string_view TerminalColor::BG_RED = "\033[41m"
staticconstexpr

◆ BG_WHITE

std::string_view TerminalColor::BG_WHITE = "\033[47m"
staticconstexpr

◆ BG_YELLOW

std::string_view TerminalColor::BG_YELLOW = "\033[43m"
staticconstexpr

◆ BLACK

std::string_view TerminalColor::BLACK = "\033[30m"
staticconstexpr

◆ BLINK

std::string_view TerminalColor::BLINK = "\033[5m"
staticconstexpr

◆ BLUE

std::string_view TerminalColor::BLUE = "\033[34m"
staticconstexpr

◆ BOLD

std::string_view TerminalColor::BOLD = "\033[1m"
staticconstexpr

◆ BRIGHT_BLACK

std::string_view TerminalColor::BRIGHT_BLACK = "\033[90m"
staticconstexpr

◆ BRIGHT_BLUE

std::string_view TerminalColor::BRIGHT_BLUE = "\033[94m"
staticconstexpr

◆ BRIGHT_CYAN

std::string_view TerminalColor::BRIGHT_CYAN = "\033[96m"
staticconstexpr

◆ BRIGHT_GREEN

std::string_view TerminalColor::BRIGHT_GREEN = "\033[92m"
staticconstexpr

◆ BRIGHT_MAGENTA

std::string_view TerminalColor::BRIGHT_MAGENTA = "\033[95m"
staticconstexpr

◆ BRIGHT_RED

std::string_view TerminalColor::BRIGHT_RED = "\033[91m"
staticconstexpr

◆ BRIGHT_WHITE

std::string_view TerminalColor::BRIGHT_WHITE = "\033[97m"
staticconstexpr

◆ BRIGHT_YELLOW

std::string_view TerminalColor::BRIGHT_YELLOW = "\033[93m"
staticconstexpr

◆ CYAN

std::string_view TerminalColor::CYAN = "\033[36m"
staticconstexpr

◆ DEFAULT

std::string_view TerminalColor::DEFAULT = "\033[39m"
staticconstexpr

◆ DIM

std::string_view TerminalColor::DIM = "\033[2m"
staticconstexpr

◆ ERASE_SCREEN

std::string_view TerminalColor::ERASE_SCREEN = "\033[2J"
staticconstexpr

◆ GREEN

std::string_view TerminalColor::GREEN = "\033[32m"
staticconstexpr

◆ ITALIC

std::string_view TerminalColor::ITALIC = "\033[3m"
staticconstexpr

◆ MAGENTA

std::string_view TerminalColor::MAGENTA = "\033[35m"
staticconstexpr

◆ MY_BLUE

std::string_view TerminalColor::MY_BLUE = "\033[38;5;33m"
staticconstexpr

◆ MY_GRAY

std::string_view TerminalColor::MY_GRAY = "\033[38;5;240m"
staticconstexpr

◆ MY_ORANGE

std::string_view TerminalColor::MY_ORANGE = "\033[38;5;166m"
staticconstexpr

◆ MY_PURPLE

std::string_view TerminalColor::MY_PURPLE = "\033[38;5;91m"
staticconstexpr

◆ RED

std::string_view TerminalColor::RED = "\033[31m"
staticconstexpr

◆ RESET

std::string_view TerminalColor::RESET = "\033[0m"
staticconstexpr

◆ STRIKE

std::string_view TerminalColor::STRIKE = "\033[9m"
staticconstexpr

◆ UNDERLINE

std::string_view TerminalColor::UNDERLINE = "\033[4m"
staticconstexpr

◆ WHITE

std::string_view TerminalColor::WHITE = "\033[37m"
staticconstexpr

◆ YELLOW

std::string_view TerminalColor::YELLOW = "\033[33m"
staticconstexpr

The documentation for this class was generated from the following file: