Sista v3.0.0-beta.10
C++ lightweight OS-agnostic library for terminal animations and videogames
Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables
sista Namespace Reference

Sista library namespace. More...

Classes

struct  ANSISettings
 Represents a set of ANSI settings including colors and attributes. More...
 
class  Border
 Represents a brick of the border with a symbol and ANSI settings. More...
 
struct  Coordinates
 Represents 2D coordinates with x and y values. More...
 
struct  Cursor
 Class representing a terminal cursor for movement operations. More...
 
class  Field
 Class representing a terminal Field for pawns and borders. More...
 
struct  Path
 Represents a movement path for a Pawn, including priority handling. More...
 
class  Pawn
 Class representing a Pawn owned by a Field or SwappableField. More...
 
struct  RGBColor
 Represents an RGB color with red, green, and blue components in True Color (24-bit). More...
 
class  SwappableField
 Class representing a terminal SwappableField for pawns and borders. More...
 

Enumerations

enum class  ForegroundColor : int {
  BLACK = 30 , RED = 31 , GREEN = 32 , YELLOW = 33 ,
  BLUE = 34 , MAGENTA = 35 , CYAN = 36 , WHITE = 37
}
 Enumeration of foreground colors for ANSI escape codes. More...
 
enum class  BackgroundColor : int {
  BLACK = 40 , RED = 41 , GREEN = 42 , YELLOW = 43 ,
  BLUE = 44 , MAGENTA = 45 , CYAN = 46 , WHITE = 47
}
 Enumeration of background colors for ANSI escape codes. More...
 
enum class  Attribute : int {
  RESET = 0 , BRIGHT = 1 , FAINT = 2 , ITALIC = 3 ,
  UNDERSCORE = 4 , BLINK = 5 , RAPID_BLINK = 6 , REVERSE = 7 ,
  HIDDEN = 8 , STRIKETHROUGH = 9
}
 Enumeration of text attributes for ANSI escape codes. More...
 
enum class  ScreenMode : int {
  MONOCROME_TEXT_40_25 = 0 , COLOR_TEXT_40_25 = 1 , MONOCROME_TEXT_80_25 = 2 , COLOR_TEXT_80_25 = 3 ,
  FOUR_COLORS_GRAPHICS_320_200 = 4 , MONOCROME_GRAPHICS_320_200 = 5 , MONOCROME_GRAPHICS_640_200 = 6 , LINE_WRAPPING = 7 ,
  COLOR_GRAPHICS_320_200 = 13 , COLOR_16_COLORS_GRAPHICS_640_200 = 14 , MONOCROME_2_COLORS_GRAPHICS_640_350 = 15 , COLOR_16_COLORS_GRAPHICS_640_350 = 16 ,
  MONOCROME_2_COLORS_GRAPHICS_640_480 = 17 , COLOR_16_COLORS_GRAPHICS_640_480 = 18 , COLOR_256_COLORS_GRAPHICS_320_200 = 19
}
 Represents various ANSI screen modes. More...
 
enum class  EraseScreen : int { FROM_CURSOR_TO_END = 0 , FROM_CURSOR_TO_BEGINNING = 1 , ENTIRE_SCREEN = 2 , ERASE_SAVED_LINES = 3 }
 Enumeration for screen erasure options in ANSI escape codes. More...
 
enum class  EraseLine : int { LINE_FROM_CURSOR_TO_END = 0 , LINE_FROM_CURSOR_TO_BEGINNING = 1 , ENTIRE_LINE = 2 }
 Enumeration for line erasure options in ANSI escape codes. More...
 
enum class  MoveCursor : char {
  UP = 'A' , DOWN = 'B' , RIGHT = 'C' , LEFT = 'D' ,
  BEGINNING_OF_NEXT_LINE = 'E' , BEGINNING_OF_PREVIOUS_LINE = 'F' , HORIZONTAL_ABSOLUTE = 'G'
}
 Enumeration for cursor movement directions in ANSI escape codes. More...
 
enum class  MoveCursorDEC : int { SAVE_CURSOR_POSITION = 7 , RESTORE_CURSOR_POSITION = 8 }
 Enumeration for DEC-specific cursor movement commands in ANSI escape codes. More...
 
enum class  MoveCursorSCO : char { SCO_SAVE_CURSOR_POSITION = 's' , SCO_RESTORE_CURSOR_POSITION = 'u' }
 Enumeration for SCO-specific cursor movement commands in ANSI escape codes. More...
 
enum class  Effect { PACMAN = 0 , MATRIX = 1 }
 Enumeration for handling out-of-bounds coordinates. More...
 

Functions

void setForegroundColor (ForegroundColor)
 Sets the foreground color using a predefined ForegroundColor enum.
 
void setBackgroundColor (BackgroundColor)
 Sets the background color using a predefined BackgroundColor enum.
 
void setAttribute (Attribute)
 Sets a text attribute using a predefined Attribute enum.
 
void resetAttribute (Attribute)
 Resets a text attribute using a predefined Attribute enum.
 
void resetAnsi ()
 Resets all ANSI settings to default values.
 
void setForegroundColor (const RGBColor &)
 Sets the foreground color using an RGBColor struct.
 
void setBackgroundColor (const RGBColor &)
 Sets the background color using an RGBColor struct.
 
void setForegroundColor (unsigned char, unsigned char, unsigned char)
 Sets the foreground color using RGB values.
 
void setBackgroundColor (unsigned char, unsigned char, unsigned char)
 Sets the background color using RGB values.
 
void setForegroundColor (unsigned char)
 Sets the foreground color using a 256-color palette index.
 
void setBackgroundColor (unsigned char)
 Sets the background color using a 256-color palette index.
 
std::string fgColorStr (ForegroundColor)
 Converts a ForegroundColor enum to its corresponding ANSI escape code string.
 
std::string bgColorStr (BackgroundColor)
 Converts a BackgroundColor enum to its corresponding ANSI escape code string.
 
std::string attrStr (Attribute)
 Converts an Attribute enum to its corresponding ANSI escape code string.
 
std::string fgColorStr (const RGBColor &)
 Converts an RGBColor struct to its corresponding ANSI escape code string for foreground color.
 
std::string bgColorStr (const RGBColor &)
 Converts RGB values to their corresponding ANSI escape code string for foreground color.
 
std::string fgColorStr (unsigned char, unsigned char, unsigned char)
 Converts RGB values to their corresponding ANSI escape code string for foreground color.
 
std::string bgColorStr (unsigned char, unsigned char, unsigned char)
 Converts RGB values to their corresponding ANSI escape code string for background color.
 
void setScreenMode (ScreenMode)
 Sets a specific screen mode.
 
void unsetScreenMode (ScreenMode)
 Unsets a specific screen mode.
 
std::bitset< 10 > make_attr_bitset (std::initializer_list< Attribute > attrs)
 Helper function to create a bitset from an initializer list of Attributes.
 
void clearScreen (bool spaces=true)
 Clears the terminal screen and optionally the scrollback buffer.
 
const char * getVersion ()
 Returns the Sista library version as a string.
 
int getVersionMajor ()
 Returns the major version number of the Sista library.
 
int getVersionMinor ()
 Returns the minor version number of the Sista library.
 
int getVersionPatch ()
 Returns the patch version number of the Sista library.
 
 _load_ext ()
 
 __getattr__ (str name)
 
 __dir__ ()
 
None set_foreground_color (int color)
 Set the terminal foreground color using one of the F_* constants.
 
None set_background_color (int color)
 Set the terminal background color using one of the B_* constants.
 
None set_attribute (int attribute)
 Enable a terminal text attribute using one of the A_* constants.
 
None reset_attribute (int attribute)
 Disable/reset a terminal text attribute using one of the A_* constants.
 
None reset_ansi ()
 Reset all ANSI text attributes and colors to the terminal defaults.
 
None clear_screen (bool spaces=True)
 Clear the terminal and reposition the cursor to top-left.
 
None print (str message)
 Print a message to the terminal using Sista's configured output stream.
 
Capsule create_ansi_settings (int fgcolor=..., int bgcolor=..., int attribute=...)
 Create an ANSI settings object and return it as a Capsule.
 
Capsule create_border (str symbol, Capsule ansi_settings)
 Create a Border object that uses a single-character symbol and ANSI settings.
 
Capsule create_coordinates (int y, int x)
 Create a Coordinates object and return it as a Capsule.
 

Variables

str MODULE_NAME = f"{__name__}._sista"
 
 _ext = _load_ext()
 
list _ext_names = [n for n in dir(_ext) if not n.startswith("_")]
 
 Capsule = Any
 
int F_BLACK
 
int F_RED
 
int F_GREEN
 
int F_YELLOW
 
int F_BLUE
 
int F_MAGENTA
 
int F_CYAN
 
int F_WHITE
 
int B_BLACK
 
int B_RED
 
int B_GREEN
 
int B_YELLOW
 
int B_BLUE
 
int B_MAGENTA
 
int B_CYAN
 
int B_WHITE
 
int A_RESET
 
int A_BRIGHT
 
int A_FAINT
 
int A_ITALIC
 
int A_UNDERLINE
 
int A_BLINK
 
int A_BLINK_FAST
 
int A_REVERSE
 
int A_HIDDEN
 
int A_STRIKETHROUGH
 
int DIRECTION_UP
 
int DIRECTION_DOWN
 
int DIRECTION_RIGHT
 
int DIRECTION_LEFT
 
int BEGINNING_OF_NEXT_LINE
 
int BEGINNING_OF_PREVIOUS_LINE
 

Detailed Description

Sista library namespace.

Python type hints and pydocstrings for the Sista C extension module.

Memory-safe and OS-agnostic library for making terminal videogames and animations.

This namespace encapsulates all components of the Sista library.

See also
ANSISettings
Coordinates

Enumeration Type Documentation

◆ Attribute

enum class sista::Attribute : int
strong

Enumeration of text attributes for ANSI escape codes.

This enum class defines various text attributes that can be used in ANSI escape codes. Each attribute is associated with its corresponding ANSI code value, ranging from 0 to 9.

See also
setAttribute(Attribute)
resetAttribute(Attribute)
Enumerator
RESET 
BRIGHT 
FAINT 
ITALIC 
UNDERSCORE 
BLINK 
RAPID_BLINK 
REVERSE 
HIDDEN 
STRIKETHROUGH 

◆ BackgroundColor

enum class sista::BackgroundColor : int
strong

Enumeration of background colors for ANSI escape codes.

This enum class defines various background colors that can be used in ANSI escape codes. Each color is associated with its corresponding ANSI code value, ranging from 40 to 47.

See also
setBackgroundColor(BackgroundColor)
Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 

◆ Effect

enum class sista::Effect
strong

Enumeration for handling out-of-bounds coordinates.

This enum class defines different effects that can be applied when a Pawn's coordinates go out of the bounds of the Field. The effects determine how the coordinates are adjusted to bring them back within valid limits.

  • PACMAN: Wraps around to the opposite side of the field (like in the PacMan game).
  • MATRIX: Wraps to the beginning of the next line (like in classic C-style arrays).
See also
Field::movingByCoordinates
Field::movePawnBy
Enumerator
PACMAN 
MATRIX 

◆ EraseLine

enum class sista::EraseLine : int
strong

Enumeration for line erasure options in ANSI escape codes.

This enum class defines various options for erasing parts of the current line in the terminal using ANSI escape codes. Each option corresponds to a specific ANSI code value.

See also
Cursor::eraseLine
Enumerator
LINE_FROM_CURSOR_TO_END 
LINE_FROM_CURSOR_TO_BEGINNING 

Erase from the cursor position to the end of the line.

ENTIRE_LINE 

Erase from the cursor position to the beginning of the line.

◆ EraseScreen

enum class sista::EraseScreen : int
strong

Enumeration for screen erasure options in ANSI escape codes.

This enum class defines various options for erasing parts of the terminal screen using ANSI escape codes. Each option corresponds to a specific ANSI code value.

See also
Cursor::eraseScreen
Enumerator
FROM_CURSOR_TO_END 
FROM_CURSOR_TO_BEGINNING 

Erase from the cursor position to the end of the screen.

ENTIRE_SCREEN 

Erase from the cursor position to the beginning of the screen.

ERASE_SAVED_LINES 

Erase the entire screen.

◆ ForegroundColor

enum class sista::ForegroundColor : int
strong

Enumeration of foreground colors for ANSI escape codes.

This enum class defines various foreground colors that can be used in ANSI escape codes. Each color is associated with its corresponding ANSI code value, ranging from 30 to 37.

See also
setForegroundColor(ForegroundColor)
Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 

◆ MoveCursor

enum class sista::MoveCursor : char
strong

Enumeration for cursor movement directions in ANSI escape codes.

This enum class defines various directions for moving the terminal cursor using ANSI escape codes. Each direction corresponds to a specific command character used in the escape sequences.

See also
Cursor::move(MoveCursor, unsigned short int)
Enumerator
UP 
DOWN 
RIGHT 
LEFT 
BEGINNING_OF_NEXT_LINE 
BEGINNING_OF_PREVIOUS_LINE 
HORIZONTAL_ABSOLUTE 

◆ MoveCursorDEC

enum class sista::MoveCursorDEC : int
strong

Enumeration for DEC-specific cursor movement commands in ANSI escape codes.

This enum class defines specific commands for saving and restoring the cursor position using DEC (Digital Equipment Corporation) ANSI escape codes. Each command corresponds to a specific ANSI code value.

See also
Cursor::move(MoveCursorDEC)
Enumerator
SAVE_CURSOR_POSITION 
RESTORE_CURSOR_POSITION 

◆ MoveCursorSCO

enum class sista::MoveCursorSCO : char
strong

Enumeration for SCO-specific cursor movement commands in ANSI escape codes.

This enum class defines specific commands for saving and restoring the cursor position using SCO (Santa Cruz Operation) ANSI escape codes. Each command corresponds to a specific command character used in the escape sequences.

See also
Cursor::move(MoveCursorSCO)
Enumerator
SCO_SAVE_CURSOR_POSITION 
SCO_RESTORE_CURSOR_POSITION 

◆ ScreenMode

enum class sista::ScreenMode : int
strong

Represents various ANSI screen modes.

This enum defines different screen modes that can be set or unset using ANSI escape codes. Each mode corresponds to a specific configuration of text and graphics display.

Enumerator
MONOCROME_TEXT_40_25 
COLOR_TEXT_40_25 
MONOCROME_TEXT_80_25 
COLOR_TEXT_80_25 
FOUR_COLORS_GRAPHICS_320_200 
MONOCROME_GRAPHICS_320_200 
MONOCROME_GRAPHICS_640_200 
LINE_WRAPPING 
COLOR_GRAPHICS_320_200 
COLOR_16_COLORS_GRAPHICS_640_200 
MONOCROME_2_COLORS_GRAPHICS_640_350 
COLOR_16_COLORS_GRAPHICS_640_350 
MONOCROME_2_COLORS_GRAPHICS_640_480 
COLOR_16_COLORS_GRAPHICS_640_480 
COLOR_256_COLORS_GRAPHICS_320_200 

Function Documentation

◆ __dir__()

sista.__dir__ ( )

◆ __getattr__()

sista.__getattr__ ( str  name)

◆ _load_ext()

sista._load_ext ( )
protected

◆ attrStr()

std::string sista::attrStr ( Attribute  )

Converts an Attribute enum to its corresponding ANSI escape code string.

Parameters
attributeThe Attribute to convert.
Returns
A string representing the ANSI escape code for the specified attribute.

This function takes an Attribute enum value and returns the corresponding ANSI escape code as a string. This can be useful for constructing custom ANSI sequences or for logging purposes.

See also
Attribute

◆ bgColorStr() [1/3]

std::string sista::bgColorStr ( BackgroundColor  )

Converts a BackgroundColor enum to its corresponding ANSI escape code string.

Parameters
colorThe BackgroundColor to convert.
Returns
A string representing the ANSI escape code for the specified background color.

This function takes a BackgroundColor enum value and returns the corresponding ANSI escape code as a string. This can be useful for constructing custom ANSI sequences or for logging purposes.

See also
BackgroundColor

◆ bgColorStr() [2/3]

std::string sista::bgColorStr ( const RGBColor )

Converts RGB values to their corresponding ANSI escape code string for foreground color.

Parameters
redThe red component (0-255).
greenThe green component (0-255).
blueThe blue component (0-255).
Returns
A string representing the ANSI escape code for the specified RGB foreground color.

This function takes RGB values and returns the corresponding ANSI escape code as a string for setting the foreground color. This can be useful for constructing custom ANSI sequences or for logging purposes.

See also
RGBColor

◆ bgColorStr() [3/3]

std::string sista::bgColorStr ( unsigned char  ,
unsigned char  ,
unsigned char   
)

Converts RGB values to their corresponding ANSI escape code string for background color.

Parameters
redThe red component (0-255).
greenThe green component (0-255).
blueThe blue component (0-255).
Returns
A string representing the ANSI escape code for the specified RGB background color.

This function takes RGB values and returns the corresponding ANSI escape code as a string for setting the background color. This can be useful for constructing custom ANSI sequences or for logging purposes.

See also
RGBColor

◆ clear_screen()

None sista.clear_screen ( bool   spaces = True)

Clear the terminal and reposition the cursor to top-left.

:param spaces:

  • True (default): clear visible content and scrollback buffer.
  • False: only reposition cursor to top-left. :raises RuntimeError: If the underlying API reports a failure.

◆ clearScreen()

void sista::clearScreen ( bool  spaces = true)

Clears the terminal screen and optionally the scrollback buffer.

Parameters
spacesIf true, clears both the screen and the scrollback buffer; if false, only moves the cursor to the top-left corner.

This function outputs ANSI escape codes to clear the terminal screen. If the spaces parameter is set to true, it also clears the scrollback buffer. After clearing, it moves the cursor to the top-left corner of the terminal.

Note
Clearing the scrollback buffer may not be necessary in all applications and can be omitted by setting spaces to false.
See also
CLS
SSB
TL

◆ create_ansi_settings()

Capsule sista.create_ansi_settings ( int   fgcolor = ...,
int   bgcolor = ...,
int   attribute = ... 
)

Create an ANSI settings object and return it as a Capsule.

The settings object describes foreground/background colors and a text attribute to be applied when rendering borders, pawns, etc.

:param fgcolor: Foreground color (one of the F_* constants). :param bgcolor: Background color (one of the B_* constants). :param attribute: Text attribute (one of the A_* constants). :return: Capsule wrapping the ANSISettings handler.

◆ create_border()

Capsule sista.create_border ( str  symbol,
Capsule  ansi_settings 
)

Create a Border object that uses a single-character symbol and ANSI settings.

:param symbol: Single character string used to draw border bricks. :param ansi_settings: Capsule returned by create_ansi_settings. :return: Capsule wrapping the Border handler.

◆ create_coordinates()

Capsule sista.create_coordinates ( int  y,
int  x 
)

Create a Coordinates object and return it as a Capsule.

Coordinates are small value objects (y,row and x,column) used by pawn creation and movement functions. Caller is responsible for freeing the capsule when no longer needed (the extension provides destructors).

:param y: Row index (unsigned short). :param x: Column index (unsigned short). :return: Capsule wrapping a Coordinates struct.

◆ fgColorStr() [1/3]

std::string sista::fgColorStr ( const RGBColor )

Converts an RGBColor struct to its corresponding ANSI escape code string for foreground color.

Parameters
colorThe RGBColor to convert.
Returns
A string representing the ANSI escape code for the specified RGB foreground color.

This function takes an RGBColor struct and returns the corresponding ANSI escape code as a string for setting the foreground color. This can be useful for constructing custom ANSI sequences or for logging purposes.

See also
RGBColor

◆ fgColorStr() [2/3]

std::string sista::fgColorStr ( ForegroundColor  )

Converts a ForegroundColor enum to its corresponding ANSI escape code string.

Parameters
colorThe ForegroundColor to convert.
Returns
A string representing the ANSI escape code for the specified foreground color.

This function takes a ForegroundColor enum value and returns the corresponding ANSI escape code as a string. This can be useful for constructing custom ANSI sequences or for logging purposes.

See also
ForegroundColor

◆ fgColorStr() [3/3]

std::string sista::fgColorStr ( unsigned char  ,
unsigned char  ,
unsigned char   
)

Converts RGB values to their corresponding ANSI escape code string for foreground color.

Parameters
redThe red component (0-255).
greenThe green component (0-255).
blueThe blue component (0-255).
Returns
A string representing the ANSI escape code for the specified RGB foreground color.

This function takes RGB values and returns the corresponding ANSI escape code as a string for setting the foreground color. This can be useful for constructing custom ANSI sequences or for logging purposes.

See also
RGBColor

◆ getVersion()

const char * sista::getVersion ( )
inline

Returns the Sista library version as a string.

Returns
A string representing the Sista library version.

This function returns the version of the Sista library in the format "MAJOR.MINOR.PATCH". It is useful for logging, debugging, or displaying version information in applications that utilize the Sista library.

See also
SISTA_VERSION

◆ getVersionMajor()

int sista::getVersionMajor ( )
inline

Returns the major version number of the Sista library.

Returns
An integer representing the major version number.

This function returns the major version number of the Sista library. The major version typically indicates significant changes or milestones in the library's development.

See also
SISTA_VERSION_MAJOR

◆ getVersionMinor()

int sista::getVersionMinor ( )
inline

Returns the minor version number of the Sista library.

Returns
An integer representing the minor version number.

This function returns the minor version number of the Sista library. The minor version typically indicates the addition of new features or improvements that are backward-compatible.

See also
SISTA_VERSION_MINOR

◆ getVersionPatch()

int sista::getVersionPatch ( )
inline

Returns the patch version number of the Sista library.

Returns
An integer representing the patch version number.

This function returns the patch version number of the Sista library. The patch version typically indicates bug fixes or minor changes that do not affect the overall functionality or compatibility of the library.

See also
SISTA_VERSION_PATCH

◆ make_attr_bitset()

std::bitset< 10 > sista::make_attr_bitset ( std::initializer_list< Attribute attrs)
inline

Helper function to create a bitset from an initializer list of Attributes.

Parameters
attrsAn initializer list of Attribute enums.
Returns
A std::bitset<10> representing the set attributes.

This function takes an initializer list of Attribute enums and converts it into a std::bitset<10>, where each bit corresponds to an attribute being set. This is useful for managing multiple attributes in the ANSISettings struct.

See also
Attribute

◆ print()

None sista.print ( str  message)

Print a message to the terminal using Sista's configured output stream.

The function respects Sista's current ANSI settings (colors/attributes) as managed by the extension.

:param message: Message to print (a single text line). :type message: str

◆ reset_ansi()

None sista.reset_ansi ( )

Reset all ANSI text attributes and colors to the terminal defaults.

◆ reset_attribute()

None sista.reset_attribute ( int  attribute)

Disable/reset a terminal text attribute using one of the A_* constants.

:param attribute: One of the A_* constants (e.g. A_RESET). :type attribute: int

◆ resetAnsi()

void sista::resetAnsi ( )

Resets all ANSI settings to default values.

This function resets the terminal's text attributes, foreground color, and background color to their default values. It outputs the corresponding ANSI escape codes to standard output.

Default settings are:

  • Attribute: RESET
  • Foreground Color: WHITE
  • Background Color: BLACK
See also
Attribute
ForegroundColor
BackgroundColor

◆ resetAttribute()

void sista::resetAttribute ( Attribute  )

Resets a text attribute using a predefined Attribute enum.

Parameters
attributeThe Attribute to reset.

This function resets the terminal's text attribute based on the provided Attribute enum value. It outputs the corresponding ANSI escape code to standard output.

See also
Attribute

◆ set_attribute()

None sista.set_attribute ( int  attribute)

Enable a terminal text attribute using one of the A_* constants.

:param attribute: One of the A_* constants (e.g. A_UNDERLINE). :type attribute: int

◆ set_background_color()

None sista.set_background_color ( int  color)

Set the terminal background color using one of the B_* constants.

:param color: One of the B_* constants (e.g. B_BLUE). :type color: int

◆ set_foreground_color()

None sista.set_foreground_color ( int  color)

Set the terminal foreground color using one of the F_* constants.

:param color: One of the F_* constants (e.g. F_RED). :type color: int

◆ setAttribute()

void sista::setAttribute ( Attribute  )

Sets a text attribute using a predefined Attribute enum.

Parameters
attributeThe Attribute to set.

This function sets the terminal's text attribute based on the provided Attribute enum value. It outputs the corresponding ANSI escape code to standard output.

See also
Attribute

◆ setBackgroundColor() [1/4]

void sista::setBackgroundColor ( BackgroundColor  )

Sets the background color using a predefined BackgroundColor enum.

Parameters
colorThe BackgroundColor to set.

This function sets the terminal's background color based on the provided BackgroundColor enum value. It outputs the corresponding ANSI escape code to standard output.

See also
BackgroundColor

◆ setBackgroundColor() [2/4]

void sista::setBackgroundColor ( const RGBColor )

Sets the background color using an RGBColor struct.

Parameters
rgbcolorThe RGBColor to set.

This function sets the terminal's background color based on the provided RGBColor struct. It extracts the red, green, and blue components and calls the appropriate function to set the color using RGB values.

See also
RGBColor

◆ setBackgroundColor() [3/4]

void sista::setBackgroundColor ( unsigned char  )

Sets the background color using a 256-color palette index.

Parameters
colorThe color index (0-255).

This function sets the terminal's background color based on the provided 256-color palette index. It outputs the corresponding ANSI escape code to standard output.

See also
256-color palette

◆ setBackgroundColor() [4/4]

void sista::setBackgroundColor ( unsigned char  ,
unsigned char  ,
unsigned char   
)

Sets the background color using RGB values.

Parameters
redThe red component (0-255).
greenThe green component (0-255).
blueThe blue component (0-255).

This function sets the terminal's background color based on the provided RGB values. It outputs the corresponding ANSI escape code to standard output.

See also
RGBColor

◆ setForegroundColor() [1/4]

void sista::setForegroundColor ( const RGBColor )

Sets the foreground color using an RGBColor struct.

Parameters
rgbcolorThe RGBColor to set.

This function sets the terminal's foreground color based on the provided RGBColor struct. It extracts the red, green, and blue components and calls the appropriate function to set the color using RGB values.

See also
RGBColor

◆ setForegroundColor() [2/4]

void sista::setForegroundColor ( ForegroundColor  )

Sets the foreground color using a predefined ForegroundColor enum.

Parameters
colorThe ForegroundColor to set.

This function sets the terminal's foreground color based on the provided ForegroundColor enum value. It outputs the corresponding ANSI escape code to standard output.

See also
ForegroundColor

◆ setForegroundColor() [3/4]

void sista::setForegroundColor ( unsigned char  )

Sets the foreground color using a 256-color palette index.

Parameters
colorThe color index (0-255).

This function sets the terminal's foreground color based on the provided 256-color palette index. It outputs the corresponding ANSI escape code to standard output.

See also
256-color palette

◆ setForegroundColor() [4/4]

void sista::setForegroundColor ( unsigned char  ,
unsigned char  ,
unsigned char   
)

Sets the foreground color using RGB values.

Parameters
redThe red component (0-255).
greenThe green component (0-255).
blueThe blue component (0-255).

This function sets the terminal's foreground color based on the provided RGB values. It outputs the corresponding ANSI escape code to standard output.

See also
RGBColor

◆ setScreenMode()

void sista::setScreenMode ( ScreenMode  )

Sets a specific screen mode.

Parameters
modeThe ScreenMode to set.

This function sets the terminal's screen mode based on the provided ScreenMode enum value. It outputs the corresponding ANSI escape code to standard output.

See also
ScreenMode

◆ unsetScreenMode()

void sista::unsetScreenMode ( ScreenMode  )

Unsets a specific screen mode.

Parameters
modeThe ScreenMode to unset.

This function unsets the terminal's screen mode based on the provided ScreenMode enum value. It outputs the corresponding ANSI escape code to standard output.

See also
ScreenMode

Variable Documentation

◆ _ext

sista._ext = _load_ext()
protected

◆ _ext_names

list sista._ext_names = [n for n in dir(_ext) if not n.startswith("_")]
protected

◆ A_BLINK

int sista.A_BLINK

◆ A_BLINK_FAST

int sista.A_BLINK_FAST

◆ A_BRIGHT

int sista.A_BRIGHT

◆ A_FAINT

int sista.A_FAINT

◆ A_HIDDEN

int sista.A_HIDDEN

◆ A_ITALIC

int sista.A_ITALIC

◆ A_RESET

int sista.A_RESET

◆ A_REVERSE

int sista.A_REVERSE

◆ A_STRIKETHROUGH

int sista.A_STRIKETHROUGH

◆ A_UNDERLINE

int sista.A_UNDERLINE

◆ B_BLACK

int sista.B_BLACK

◆ B_BLUE

int sista.B_BLUE

◆ B_CYAN

int sista.B_CYAN

◆ B_GREEN

int sista.B_GREEN

◆ B_MAGENTA

int sista.B_MAGENTA

◆ B_RED

int sista.B_RED

◆ B_WHITE

int sista.B_WHITE

◆ B_YELLOW

int sista.B_YELLOW

◆ BEGINNING_OF_NEXT_LINE

int sista.BEGINNING_OF_NEXT_LINE

◆ BEGINNING_OF_PREVIOUS_LINE

int sista.BEGINNING_OF_PREVIOUS_LINE

◆ Capsule

sista.Capsule = Any

◆ DIRECTION_DOWN

int sista.DIRECTION_DOWN

◆ DIRECTION_LEFT

int sista.DIRECTION_LEFT

◆ DIRECTION_RIGHT

int sista.DIRECTION_RIGHT

◆ DIRECTION_UP

int sista.DIRECTION_UP

◆ F_BLACK

int sista.F_BLACK

◆ F_BLUE

int sista.F_BLUE

◆ F_CYAN

int sista.F_CYAN

◆ F_GREEN

int sista.F_GREEN

◆ F_MAGENTA

int sista.F_MAGENTA

◆ F_RED

int sista.F_RED

◆ F_WHITE

int sista.F_WHITE

◆ F_YELLOW

int sista.F_YELLOW

◆ MODULE_NAME

str sista.MODULE_NAME = f"{__name__}._sista"