The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::color::ColorScheme Class Reference

Accessor methods for obtaining color code strings. More...

#include <Colors.hpp>

Collaboration diagram for sparta::color::ColorScheme:

Public Member Functions

virtual void enabled (bool enabled)
 would we like to enable or disable colors. By invoking this function with false, all color accessor functions return the empty string
 
const char *const * nextBasicColor (const char *const *color=nullptr)
 Find the next basic color after the color inputted.
 
const char * color (Color c)
 The accessors that should always be used for colors.
 

Static Public Member Functions

static ColorSchemegetDefaultScheme ()
 Return the default instance to the global.
 

Static Public Attributes

static ColorScheme_GBL_COLOR_SCHEME
 The default color scheme singleton.
 

Protected Attributes

bool enabled_ = true
 
char const * empty_ [1] ={""}
 Whether or not we are returning real colors.
 
std::vector< const char * > all_colors_
 A dummy empty string array to make nextBasicColor work.
 
std::vector< const char * > basic_colors_
 A list of colors in order.
 

Detailed Description

Accessor methods for obtaining color code strings.

The idea behind ColorScheme is to have the ability to disable terminal colors in the model with a simple flag. There will be a single ColorScheme instance that is controlled by a sparta command line option disables color for that instance. The majority of output can use that instance unless explicit control over colorization enable/disabled is required.

Definition at line 120 of file Colors.hpp.

Constructor & Destructor Documentation

◆ ~ColorScheme()

virtual sparta::color::ColorScheme::~ColorScheme ( )
inlinevirtual

Definition at line 144 of file Colors.hpp.

◆ ColorScheme()

sparta::color::ColorScheme::ColorScheme ( )
inline

Definition at line 153 of file Colors.hpp.

Member Function Documentation

◆ color()

const char * sparta::color::ColorScheme::color ( Color  c)
inline

The accessors that should always be used for colors.

Definition at line 212 of file Colors.hpp.

◆ enabled()

virtual void sparta::color::ColorScheme::enabled ( bool  enabled)
inlinevirtual

would we like to enable or disable colors. By invoking this function with false, all color accessor functions return the empty string

Parameters
enableda boolean for whether or not we should return true color codes or empty strings.

Definition at line 182 of file Colors.hpp.

Here is the call graph for this function:

◆ getDefaultScheme()

static ColorScheme & sparta::color::ColorScheme::getDefaultScheme ( )
inlinestatic

Return the default instance to the global.

Definition at line 147 of file Colors.hpp.

◆ nextBasicColor()

const char *const * sparta::color::ColorScheme::nextBasicColor ( const char *const *  color = nullptr)
inline

Find the next basic color after the color inputted.

Definition at line 191 of file Colors.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ _GBL_COLOR_SCHEME

ColorScheme* sparta::color::ColorScheme::_GBL_COLOR_SCHEME
static

The default color scheme singleton.

Definition at line 123 of file Colors.hpp.

◆ all_colors_

std::vector<const char*> sparta::color::ColorScheme::all_colors_
protected

A dummy empty string array to make nextBasicColor work.

Definition at line 219 of file Colors.hpp.

◆ basic_colors_

std::vector<const char*> sparta::color::ColorScheme::basic_colors_
protected

A list of colors in order.

Definition at line 220 of file Colors.hpp.

◆ empty_

char const* sparta::color::ColorScheme::empty_[1] ={""}
protected

Whether or not we are returning real colors.

Definition at line 218 of file Colors.hpp.

◆ enabled_

bool sparta::color::ColorScheme::enabled_ = true
protected

Definition at line 217 of file Colors.hpp.


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