Sista v3.0.0-alpha.1
Sista is a C++ lightweight OS-agnostic library for terminal animations and videogames
|
Represents a set of ANSI settings including colors and attributes. More...
#include <ansi.hpp>
Public Member Functions | |
ANSISettings () | |
ANSISettings (const RGBColor &, const RGBColor &, const Attribute &) | |
Parameterized constructor with RGBColor for both foreground and background. | |
ANSISettings (const ForegroundColor &, const BackgroundColor &, const Attribute &) | |
Parameterized constructor with ForegroundColor and BackgroundColor enums. | |
ANSISettings (const RGBColor &, const BackgroundColor &, const Attribute &) | |
Parameterized constructor with ForegroundColor enum and RGBColor for background. | |
ANSISettings (const ForegroundColor &, const RGBColor &, const Attribute &) | |
Parameterized constructor with RGBColor for foreground and BackgroundColor enum. | |
void | apply () const |
Applies the ANSI settings to the terminal. | |
Public Attributes | |
std::variant< ForegroundColor, RGBColor > | foregroundColor |
Foreground color, can be ForegroundColor or RGBColor. | |
std::variant< BackgroundColor, RGBColor > | backgroundColor |
Background color, can be BackgroundColor or RGBColor. | |
Attribute | attribute |
Text attribute setting. | |
Represents a set of ANSI settings including colors and attributes.
This struct holds the foreground color, background color, and text attribute settings for ANSI escape codes. It provides constructors for various combinations of color types (predefined enums and RGB colors) and a method to apply these settings to the terminal.
sista::ANSISettings::ANSISettings | ( | ) |
Default constructor initializing to white foreground, black background, and reset attribute.
sista::ANSISettings::ANSISettings | ( | const ForegroundColor & | foregroundColor_, |
const BackgroundColor & | backgroundColor_, | ||
const Attribute & | attribute_ | ||
) |
Parameterized constructor with ForegroundColor and BackgroundColor enums.
foregroundColor_ | The ForegroundColor for the foreground. |
backgroundColor_ | The BackgroundColor for the background. |
attribute_ | The text Attribute. |
sista::ANSISettings::ANSISettings | ( | const RGBColor & | foregroundColor_, |
const BackgroundColor & | backgroundColor_, | ||
const Attribute & | attribute_ | ||
) |
sista::ANSISettings::ANSISettings | ( | const ForegroundColor & | foregroundColor_, |
const RGBColor & | backgroundColor_, | ||
const Attribute & | attribute_ | ||
) |
void sista::ANSISettings::apply | ( | ) | const |
Applies the ANSI settings to the terminal.
This method applies the stored foreground color, background color, and text attribute settings to the terminal by calling the appropriate functions to set each property.
The settings will be visible on characters printed after this call.
Attribute sista::ANSISettings::attribute |
Text attribute setting.
std::variant<BackgroundColor, RGBColor> sista::ANSISettings::backgroundColor |
Background color, can be BackgroundColor or RGBColor.
This variant holds either a predefined BackgroundColor enum value or an RGBColor struct for custom colors.
std::variant<ForegroundColor, RGBColor> sista::ANSISettings::foregroundColor |
Foreground color, can be ForegroundColor or RGBColor.
This variant holds either a predefined ForegroundColor enum value or an RGBColor struct for custom colors.