Sista v3.0.0-alpha.1
Sista is a C++ lightweight OS-agnostic library for terminal animations and videogames
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
sista::ANSISettings Struct Reference

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, RGBColorforegroundColor
 Foreground color, can be ForegroundColor or RGBColor.
 
std::variant< BackgroundColor, RGBColorbackgroundColor
 Background color, can be BackgroundColor or RGBColor.
 
Attribute attribute
 Text attribute setting.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ANSISettings() [1/5]

sista::ANSISettings::ANSISettings ( )

Default constructor initializing to white foreground, black background, and reset attribute.

◆ ANSISettings() [2/5]

sista::ANSISettings::ANSISettings ( const RGBColor foregroundColor_,
const RGBColor backgroundColor_,
const Attribute attribute_ 
)

Parameterized constructor with RGBColor for both foreground and background.

Parameters
foregroundColor_The RGBColor for the foreground.
backgroundColor_The RGBColor for the background.
attribute_The text Attribute.

◆ ANSISettings() [3/5]

sista::ANSISettings::ANSISettings ( const ForegroundColor foregroundColor_,
const BackgroundColor backgroundColor_,
const Attribute attribute_ 
)

Parameterized constructor with ForegroundColor and BackgroundColor enums.

Parameters
foregroundColor_The ForegroundColor for the foreground.
backgroundColor_The BackgroundColor for the background.
attribute_The text Attribute.

◆ ANSISettings() [4/5]

sista::ANSISettings::ANSISettings ( const RGBColor foregroundColor_,
const BackgroundColor backgroundColor_,
const Attribute attribute_ 
)

Parameterized constructor with ForegroundColor enum and RGBColor for background.

Parameters
foregroundColor_The ForegroundColor for the foreground.
backgroundColor_The RGBColor for the background.
attribute_The text Attribute.

◆ ANSISettings() [5/5]

sista::ANSISettings::ANSISettings ( const ForegroundColor foregroundColor_,
const RGBColor backgroundColor_,
const Attribute attribute_ 
)

Parameterized constructor with RGBColor for foreground and BackgroundColor enum.

Parameters
foregroundColor_The RGBColor for the foreground.
backgroundColor_The BackgroundColor for the background.
attribute_The text Attribute.

Member Function Documentation

◆ apply()

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.

See also
setForegroundColor
setBackgroundColor
setAttribute

Member Data Documentation

◆ attribute

Attribute sista::ANSISettings::attribute

Text attribute setting.

◆ backgroundColor

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.

See also
BackgroundColor
RGBColor

◆ foregroundColor

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.

See also
ForegroundColor
RGBColor

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