sculpto
Enumerations | Functions
scl::console Namespace Reference

Enumerations

enum class  color {
  BLACK , RED , GREEN , YELLOW ,
  BLUE , MAGENTA , CYAN , WHITE
}
 

Functions

std::string color_literal (color ForegroundColor)
 
std::string color_literal (color ForegroundColor, color BackgroundColor)
 
const std::string color_literal_reset ()
 

Enumeration Type Documentation

◆ color

enum class scl::console::color
strong

Enum type represending console color code.

Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 

Definition at line 14 of file console_colors.h.

Function Documentation

◆ color_literal() [1/2]

std::string scl::console::color_literal ( color  ForegroundColor)
inline
  • Creating string literal for changing both foreground console colors.
Parameters
ForegroundColor- new console foreground color.
Returns
String literal changing console color.

Definition at line 32 of file console_colors.h.

33 {
34 int foreground = 30 + (int)ForegroundColor;
35
36 return std::string("\x1b[") + std::to_string(foreground) + "m";
37 }

◆ color_literal() [2/2]

std::string scl::console::color_literal ( color  ForegroundColor,
color  BackgroundColor 
)
inline
  • Creating string literal for changing both background and foreground console colors.
Parameters
ForegroundColor- new console foreground color.
BackgroundColor- new console background color.
Returns
String literal changing console color.

Definition at line 46 of file console_colors.h.

48 {
49 int foreground = 30 + (int)ForegroundColor;
50 int backgound = 40 + (int)BackgroundColor;
51
52 return std::string("\x1b[") +
53 std::to_string(foreground) + ";" +
54 std::to_string(backgound) + "m";
55 }

◆ color_literal_reset()

const std::string scl::console::color_literal_reset ( )
inline
  • Creating string literal for reset console colors.
Returns
String literal reseting console color.

Definition at line 62 of file console_colors.h.

63 {
64 return "\x1b[0m";
65 }