linc 0.7
Linc is a general-purpose programming language inspired by C
Loading...
Searching...
No Matches
linc::Colors Class Referencefinal

Color utility static class. More...

#include <Colors.hpp>

Public Types

enum class  Color : char {
  Default , Black , Red , Green ,
  Yellow , Blue , Purple , Cyan ,
  White
}
 Enum representing basic ANSI foreground colors.
 

Static Public Member Functions

static std::string push (Color color)
 Push the specified color onto the stack.
 
static std::string pop ()
 Pop the top of the color-stack.
 
static std::string toANSI (Color color)
 Convert an enumerator to its corresponding ANSI color-sequence, such that following text is of the specified color (until re-specified).
 
static Color getCurrentColor ()
 Get the color at the top of the stack. If the stack is empty, return the default color.
 

Detailed Description

Color utility static class.

Member Function Documentation

◆ getCurrentColor()

static Color linc::Colors::getCurrentColor ( )
inlinestaticnodiscard

Get the color at the top of the stack. If the stack is empty, return the default color.

Returns
The enumerator corresponding to the current color.

◆ pop()

std::string linc::Colors::pop ( )
static

Pop the top of the color-stack.

Returns
The stack top after removing the color, converted to its ANSI sequence equivalent.

◆ push()

std::string linc::Colors::push ( Color color)
static

Push the specified color onto the stack.

Parameters
colorColor to push.
Returns
The specified color converted to its ANSI sequence equivalent.

◆ toANSI()

std::string linc::Colors::toANSI ( Color color)
staticnodiscard

Convert an enumerator to its corresponding ANSI color-sequence, such that following text is of the specified color (until re-specified).

Parameters
colorThe enumerator corresponding to the selected color.
Returns
The resulting ANSI color-sequence.

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