libfly  6.2.2
C++20 utility library for Linux, macOS, and Windows
fly::logger::Color Struct Reference

#include <styler.hpp>

Public Types

enum  StandardColor {
  Black , Red , Green , Yellow ,
  Blue , Magenta , Cyan , White
}
 
enum  Plane { Foreground , Background }
 

Public Member Functions

constexpr Color (std::uint8_t color, Plane plane=Foreground) noexcept
 

Public Attributes

const std::uint8_t m_color
 
const Plane m_plane
 

Detailed Description

Struct to modify the foreground or background color of a std::ostream.

Member Enumeration Documentation

◆ Plane

Constants for the plane that should be modified.

◆ StandardColor

Constants for standard colors.

On Linux and macOS, a color may be any value in the range [0, 255]. While only the 8 standard colors are listed here, any 8-bit integer value may be cast to a color. The color values correspond to the ANSI 256-color lookup table:

https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit.

On Windows, the color may only be one of the 8 standard colors listed here.

Constructor & Destructor Documentation

◆ Color()

constexpr fly::logger::Color::Color ( std::uint8_t  color,
Plane  plane = Foreground 
)
inlineexplicitconstexprnoexcept

Construct a Color as either a foreground or background color.

Parameters
colorThe 256-color value to apply.
planeThe plane (default foreground) that should be modified.

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