GlitchyByte Lib  0.3.1
GlitchyByte general library to bootstrap development.
Typedefs | Functions
gb::terminal Namespace Reference

Typedefs

typedef uint32_t color_t
 

Functions

static constexpr color_t rgb (color_t const r, color_t const g, color_t const b) noexcept
 
static constexpr color_t grey (color_t const step) noexcept
 
static constexpr std::string colorText (std::string_view const str, color_t const color) noexcept
 
static constexpr std::string clearToEndOfLine () noexcept
 
static constexpr std::string clearToStartOfLine () noexcept
 
static constexpr std::string cursorUp (uint const n=1) noexcept
 
static constexpr std::string cursorDown (uint const n=1) noexcept
 
static constexpr std::string cursorForward (uint const n=1) noexcept
 
static constexpr std::string cursorBack (uint const n=1) noexcept
 

Typedef Documentation

◆ color_t

typedef uint32_t gb::terminal::color_t

Function Documentation

◆ rgb()

static constexpr color_t gb::terminal::rgb ( color_t const  r,
color_t const  g,
color_t const  b 
)
inlinestaticconstexprnoexcept

Converts rgb values into a single color code.

Parameters
rRed value between [0, 6).
gGreen value between [0, 6).
bBlue value between [0, 6).
Returns
The color code.

◆ grey()

static constexpr color_t gb::terminal::grey ( color_t const  step)
inlinestaticconstexprnoexcept

Converts a grey step into a color code.

Parameters
stepGrey step between [0, 24).
Returns
The color code.

◆ colorText()

static constexpr std::string gb::terminal::colorText ( std::string_view const  str,
color_t const  color 
)
inlinestaticconstexprnoexcept

Returns a string that represents the given string in the given color.

Parameters
strString to apply color.
colorColor.
Returns
The string in color.

◆ clearToEndOfLine()

static constexpr std::string gb::terminal::clearToEndOfLine ( )
inlinestaticconstexprnoexcept

Returns a string that clears to end of line.

Returns
The code string.

◆ clearToStartOfLine()

static constexpr std::string gb::terminal::clearToStartOfLine ( )
inlinestaticconstexprnoexcept

Returns a string that clears to start of line.

Returns
The code string.

◆ cursorUp()

static constexpr std::string gb::terminal::cursorUp ( uint const  n = 1)
inlinestaticconstexprnoexcept

Returns a string that moves the cursor up.

Parameters
nNumber of times to move cursor.
Returns
The code string.

◆ cursorDown()

static constexpr std::string gb::terminal::cursorDown ( uint const  n = 1)
inlinestaticconstexprnoexcept

Returns a string that moves the cursor down.

Parameters
nNumber of times to move cursor.
Returns
The code string.

◆ cursorForward()

static constexpr std::string gb::terminal::cursorForward ( uint const  n = 1)
inlinestaticconstexprnoexcept

Returns a string that moves the cursor forward.

Parameters
nNumber of times to move cursor.
Returns
The code string.

◆ cursorBack()

static constexpr std::string gb::terminal::cursorBack ( uint const  n = 1)
inlinestaticconstexprnoexcept

Returns a string that moves the cursor back.

Parameters
nNumber of times to move cursor.
Returns
The code string.