Pretty Diagnostics
Create your own pretty diagnostics
Loading...
Searching...
No Matches
color.hpp File Reference
#include <ostream>
Include dependency graph for color.hpp:

Go to the source code of this file.

Data Structures

struct  pretty_diagnostics::color::SyledText< N >
 Holds a piece of text together with one or more ANSI style codes. More...
 

Namespaces

namespace  pretty_diagnostics
 
namespace  pretty_diagnostics::color
 

Enumerations

enum class  pretty_diagnostics::color::Code {
  pretty_diagnostics::color::Reset = 0 , pretty_diagnostics::color::Bold = 1 , pretty_diagnostics::color::Dim = 2 , pretty_diagnostics::color::Italic = 3 ,
  pretty_diagnostics::color::Underline = 4 , pretty_diagnostics::color::Blink = 5 , pretty_diagnostics::color::Reverse = 7 , pretty_diagnostics::color::Hidden = 8 ,
  pretty_diagnostics::color::Strikethrough = 9 , pretty_diagnostics::color::FgBlack = 30 , pretty_diagnostics::color::FgRed = 31 , pretty_diagnostics::color::FgGreen = 32 ,
  pretty_diagnostics::color::FgYellow = 33 , pretty_diagnostics::color::FgBlue = 34 , pretty_diagnostics::color::FgMagenta = 35 , pretty_diagnostics::color::FgCyan = 36 ,
  pretty_diagnostics::color::FgWhite = 37 , pretty_diagnostics::color::FgDefault = 39 , pretty_diagnostics::color::BgBlack = 40 , pretty_diagnostics::color::BgRed = 41 ,
  pretty_diagnostics::color::BgGreen = 42 , pretty_diagnostics::color::BgYellow = 43 , pretty_diagnostics::color::BgBlue = 44 , pretty_diagnostics::color::BgMagenta = 45 ,
  pretty_diagnostics::color::BgCyan = 46 , pretty_diagnostics::color::BgWhite = 47 , pretty_diagnostics::color::BgDefault = 49 , pretty_diagnostics::color::FgBrightBlack = 90 ,
  pretty_diagnostics::color::FgBrightRed = 91 , pretty_diagnostics::color::FgBrightGreen = 92 , pretty_diagnostics::color::FgBrightYellow = 93 , pretty_diagnostics::color::FgBrightBlue = 94 ,
  pretty_diagnostics::color::FgBrightMagenta = 95 , pretty_diagnostics::color::FgBrightCyan = 96 , pretty_diagnostics::color::FgBrightWhite = 97 , pretty_diagnostics::color::BgBrightBlack = 100 ,
  pretty_diagnostics::color::BgBrightRed = 101 , pretty_diagnostics::color::BgBrightGreen = 102 , pretty_diagnostics::color::BgBrightYellow = 103 , pretty_diagnostics::color::BgBrightBlue = 104 ,
  pretty_diagnostics::color::BgBrightMagenta = 105 , pretty_diagnostics::color::BgBrightCyan = 106 , pretty_diagnostics::color::BgBrightWhite = 107
}
 ANSI escape codes for text styling and coloring. More...
 

Functions

std::ostream & pretty_diagnostics::color::operator<< (std::ostream &os, Code code)
 Outputs a single ANSI escape code to the given stream. More...
 
template<std::size_t N>
std::ostream & pretty_diagnostics::color::operator<< (std::ostream &os, const SyledText< N > &text)
 Outputs styled text to the given stream. More...
 
template<typename... Codes>
requires (std::conjunction_v<std::is_same<Codes, Code>...>)
SyledText< sizeof...(Codes)> pretty_diagnostics::color::STYLE (std::string_view text, Codes... codes)
 Creates a styled text object from a text and a set of ANSI codes. More...
 
int pretty_diagnostics::color::color_enabled_index ()
 Returns a unique std::ios_base::xalloc index used to store per-stream color enable state. More...
 
void pretty_diagnostics::color::set_color_enabled (std::ostream &os, bool enabled)
 Enables or disables color output for a specific output stream. More...
 
bool pretty_diagnostics::color::is_color_enabled (std::ostream &os)
 Checks whether color output is enabled for the given stream. More...
 
bool pretty_diagnostics::color::is_colorable (const std::ostream &os)
 Checks whether the given output stream supports colored output. More...
 
void pretty_diagnostics::color::auto_enable_color (std::ostream &os)
 Enables or disables color output for a stream based on its capability. More...