Sista v3.0.0-alpha.1
Sista is a C++ lightweight OS-agnostic library for terminal animations and videogames
Loading...
Searching...
No Matches
Namespaces | Functions
ansi.cpp File Reference

Implementation of ANSI functions and classes. More...

#include "ansi.hpp"
#include <iostream>
Include dependency graph for ansi.cpp:

Namespaces

namespace  sista
 Sista library namespace.
 

Functions

void sista::setForegroundColor (ForegroundColor)
 Sets the foreground color using a predefined ForegroundColor enum.
 
void sista::setBackgroundColor (BackgroundColor)
 Sets the background color using a predefined BackgroundColor enum.
 
void sista::setAttribute (Attribute)
 Sets a text attribute using a predefined Attribute enum.
 
void sista::resetAttribute (Attribute)
 Resets a text attribute using a predefined Attribute enum.
 
void sista::resetAnsi ()
 Resets all ANSI settings to default values.
 
void sista::setForegroundColor (const RGBColor &)
 Sets the foreground color using an RGBColor struct.
 
void sista::setBackgroundColor (const RGBColor &)
 Sets the background color using an RGBColor struct.
 
void sista::setForegroundColor (unsigned short int, unsigned short int, unsigned short int)
 Sets the foreground color using RGB values.
 
void sista::setBackgroundColor (unsigned short int, unsigned short int, unsigned short int)
 Sets the background color using RGB values.
 
void sista::setForegroundColor (unsigned short int)
 Sets the foreground color using a 256-color palette index.
 
void sista::setBackgroundColor (unsigned short int)
 Sets the background color using a 256-color palette index.
 
void sista::setScreenMode (ScreenMode)
 Sets a specific screen mode.
 
void sista::unsetScreenMode (ScreenMode)
 Unsets a specific screen mode.
 

Detailed Description

Implementation of ANSI functions and classes.

This file contains the implementation of functions and classes for handling ANSI escape codes, including setting foreground and background colors, text attributes, and screen modes.

The implementation includes support for both standard colors and RGB colors, as well as managing ANSI settings through the ANSISettings class.

The code is designed to work with C++17 and later standards.

Author
FLAK-ZOSO
Date
2022-2025
Version
3.0.0
Note
Many niche features are not implemented, see references for more details.
Not all terminals support all ANSI features.
See also
https://en.wikipedia.org/wiki/ANSI_escape_code
https://gist.github.com/ConnerWill/d4b6c776b509add763e17f9f113fd25b