clutchlog 0.17
clutchlog::fmt::color_16M Struct Reference

Abstract base class for 16M colors objects (24-bits ANSI). More...

#include <clutchlog.h>

+ Inheritance diagram for clutchlog::fmt::color_16M:
+ Collaboration diagram for clutchlog::fmt::color_16M:

Detailed Description

Abstract base class for 16M colors objects (24-bits ANSI).

Definition at line 587 of file clutchlog.h.

Public Member Functions

 color_16M (ground t)
 Constructor. More...
 
 color_16M (ground t, short r, short g, short b)
 Numeric triplet constructor. More...
 
 color_16M (ground t, const std::string &srgb)
 Hex triplet string constructor. More...
 
bool is_set () const
 Returns true if the underying representation encodes an existing color. More...
 
std::ostream & print_on (std::ostream &os) const
 Print the color RGB triplet on the given stream. More...
 
- Public Member Functions inherited from clutchlog::fmt::color
 color (ansi a, ground g)
 Constructor. More...
 
virtual bool is_set () const =0
 Should return true if the underying representation encodes an existing color. More...
 
virtual std::ostream & print_on (std::ostream &os) const =0
 Should print the underlying representation on the given stream. More...
 

Public Attributes

short red
 The encoded RGB indices. More...
 
short green
 
short blue
 
- Public Attributes inherited from clutchlog::fmt::color
ansi mode
 
enum clutchlog::fmt::color::ground type
 Type of color (foreground or background).
 

Additional Inherited Members

- Public Types inherited from clutchlog::fmt::color
enum class  ground { fore = 38 , back = 48 }
 Codes for representing foreground or background. More...
 

Constructor & Destructor Documentation

◆ color_16M() [1/3]

clutchlog::fmt::color_16M::color_16M ( ground  t)
inline

Constructor.

Parameters
tForeground or background tag.

Definition at line 596 of file clutchlog.h.

◆ color_16M() [2/3]

clutchlog::fmt::color_16M::color_16M ( ground  t,
short  r,
short  g,
short  b 
)
inline

Numeric triplet constructor.

Parameters
tForeground or background tag.
rRed color component.
gGreen color component.
bBlue color component.

Definition at line 605 of file clutchlog.h.

◆ color_16M() [3/3]

clutchlog::fmt::color_16M::color_16M ( ground  t,
const std::string &  srgb 
)
inline

Hex triplet string constructor.

Note
If the given string is ill-formed, it will silently encode a "no color".
Parameters
tForeground or background tag.
srgbA "web color" hexadecimal triplet of two characters, starting with a leading number sign (e.g. "#0055ff").

Definition at line 615 of file clutchlog.h.

References red.

Member Function Documentation

◆ is_set()

bool clutchlog::fmt::color_16M::is_set ( ) const
inlinevirtual

Returns true if the underying representation encodes an existing color.

Implements clutchlog::fmt::color.

Definition at line 637 of file clutchlog.h.

References red.

◆ print_on()

std::ostream & clutchlog::fmt::color_16M::print_on ( std::ostream &  os) const
inlinevirtual

Print the color RGB triplet on the given stream.

Implements clutchlog::fmt::color.

Definition at line 640 of file clutchlog.h.

References red.

Member Data Documentation

◆ red

short clutchlog::fmt::color_16M::red

The encoded RGB indices.

"No color" is encoded as -1.

Definition at line 591 of file clutchlog.h.

Referenced by color_16M(), is_set(), and print_on().

◆ green

short clutchlog::fmt::color_16M::green

Definition at line 591 of file clutchlog.h.

◆ blue

short clutchlog::fmt::color_16M::blue

Definition at line 591 of file clutchlog.h.


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