Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Binary_ANSI24_Palette< State > Struct Template Reference

ANSI 24-bit colour palette for binary frames. More...

#include <ca-ascii.H>

Collaboration diagram for Aleph::CA::Binary_ANSI24_Palette< State >:
[legend]

Public Member Functions

std::string operator() (const State &value) const
 Map a cell state to an ANSI-coloured glyph.
 
std::size_t glyph_width () const noexcept
 Visible width of a single rendered cell, in columns.
 

Public Attributes

State dead {}
 state considered dead
 
RGB8 dead_colour {20, 24, 28}
 background colour for dead cells
 
RGB8 alive_colour {230, 245, 255}
 background colour for live cells
 
std::string glyph = " "
 glyph painted with the background
 

Detailed Description

template<typename State>
struct Aleph::CA::Binary_ANSI24_Palette< State >

ANSI 24-bit colour palette for binary frames.

The returned string contains terminal escape codes and a reset sequence. It is intended for interactive terminals, not golden files.

Template Parameters
Statecell state type.

Definition at line 118 of file ca-ascii.H.

Member Function Documentation

◆ glyph_width()

template<typename State >
std::size_t Aleph::CA::Binary_ANSI24_Palette< State >::glyph_width ( ) const
inlinenoexcept

Visible width of a single rendered cell, in columns.

The ANSI escape codes are zero-width on a real terminal, so the visible width equals glyph.size().

Returns
number of terminal columns occupied by one cell.

Definition at line 145 of file ca-ascii.H.

References Aleph::CA::Binary_ANSI24_Palette< State >::glyph.

◆ operator()()

template<typename State >
std::string Aleph::CA::Binary_ANSI24_Palette< State >::operator() ( const State &  value) const
inline

Member Data Documentation

◆ alive_colour

template<typename State >
RGB8 Aleph::CA::Binary_ANSI24_Palette< State >::alive_colour {230, 245, 255}

background colour for live cells

Definition at line 122 of file ca-ascii.H.

Referenced by Aleph::CA::Binary_ANSI24_Palette< State >::operator()().

◆ dead

template<typename State >
State Aleph::CA::Binary_ANSI24_Palette< State >::dead {}

state considered dead

Definition at line 120 of file ca-ascii.H.

Referenced by Aleph::CA::Binary_ANSI24_Palette< State >::operator()().

◆ dead_colour

template<typename State >
RGB8 Aleph::CA::Binary_ANSI24_Palette< State >::dead_colour {20, 24, 28}

background colour for dead cells

Definition at line 121 of file ca-ascii.H.

Referenced by Aleph::CA::Binary_ANSI24_Palette< State >::operator()().

◆ glyph

template<typename State >
std::string Aleph::CA::Binary_ANSI24_Palette< State >::glyph = " "

glyph painted with the background

Definition at line 123 of file ca-ascii.H.

Referenced by Aleph::CA::Binary_ANSI24_Palette< State >::glyph_width(), and Aleph::CA::Binary_ANSI24_Palette< State >::operator()().


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