ROSE 0.11.145.147
|
Colors.
Classes | |
struct | Colorization |
Control colored command output. More... | |
class | ColorizationMerge |
class | ColorizationParser |
Parses an output color specification. More... | |
class | Gradient |
Mapping from floating point to color. More... | |
class | HSV |
Colors in HSV space. More... | |
class | RGB |
Colors in RGB space. More... | |
Typedefs | |
typedef double | Component |
Type for color components. | |
Enumerations | |
enum class | Enabled { OFF , ON , AUTO } |
Whether colored output is enabled. More... | |
enum class | Theme { DARK_ON_LIGHT , LIGHT_ON_DARK } |
Color theme. More... | |
enum class | Layer { NONE , FOREGROUND , BACKGROUND } |
Layer to which color applies. More... | |
enum class | AnsiColor { CLEAR , RED , GREEN , YELLOW , BLUE , MAGENTA , CYAN , GRAY } |
ANSI color names for terminal output. More... | |
Functions | |
ColorizationParser::Ptr | colorizationParser (Colorization &storage) |
ColorizationParser::Ptr | colorizationParser () |
template<typename T > | |
T | clip (T c) |
Clip a floating point value between 0 and 1. | |
HSV | invertBrightness (const HSV &) |
Invert the brightness. | |
ROSE_UTIL_API HSV | darken (const HSV &, double amount) |
Darken a color. | |
ROSE_UTIL_API HSV | lighten (const HSV &, double amount) |
Lighten a color. | |
ROSE_UTIL_API HSV | fade (const HSV &, double amount) |
Make a color less saturated. | |
HSV | terminal (const HSV &color, const Colorization &) |
Adjust color for terminal. | |
ROSE_UTIL_API std::string | toHtml (const RGB &) |
Create an HTML color string. | |
ROSE_UTIL_API std::string | toAnsi (const RGB &, Layer) |
Create an ANSI color escape. | |
std::ostream & | operator<< (std::ostream &, const RGB &) |
std::ostream & | operator<< (std::ostream &, const HSV &) |
std::ostream & | operator<< (std::ostream &, const Gradient &) |
std::string | colorName (AnsiColor) |
Convert a color enum to a string. | |
std::string | ansiColorEscape (AnsiColor) |
ANSI color escape for terminal output. | |
Variables | |
const HSV | HSV_CLEAR |
const HSV | HSV_BLACK |
Black. | |
const HSV | HSV_WHITE |
White. | |
const HSV | HSV_RED |
Red. | |
const HSV | HSV_GREEN |
Green. | |
const HSV | HSV_BLUE |
Blue. | |
const HSV | HSV_CYAN |
Cyan. | |
const HSV | HSV_MAGENTA |
Magenta. | |
const HSV | HSV_YELLOW |
Yellow. | |
const HSV | HSV_GRAY |
Gray. | |
typedef double Rose::Color::Component |
|
strong |
|
strong |
|
strong |
|
strong |
T Rose::Color::clip | ( | T | c | ) |
Clip a floating point value between 0 and 1.
Definition at line 127 of file Color.h.
Referenced by Rose::Color::HSV::HSV(), and Rose::Color::RGB::RGB().
Invert the brightness.
Light colors will become dark, dark colors will become light. The hue, saturation and alpha are not affected.
Darken a color.
Makes a color darker according to amount
, which should be in the range [0..1]. If amount
is zero then the value is not changed, if amount
is one then the color becomes black, others are interpolated linearly. This method does not affect the hue, saturation, or alpha.
Lighten a color.
Makes a color lighter by adjusting its value upward by the specified ratio. A value of zero does not affect the lightness while a value of one will make it white. Other values are linearly interpolated between those two points.
Make a color less saturated.
Makes a color less saturated according to amount
. An amount of zero does not change the saturation, one removes all saturation, and other values are linearly interpolated between those two extremes.
HSV Rose::Color::terminal | ( | const HSV & | color, |
const Colorization & | |||
) |
Adjust color for terminal.
Given a color suitable for a dark foreground on a light background (typical tty or printed output), convert the color as specified by the global color output command-line options.
ROSE_UTIL_API std::string Rose::Color::toHtml | ( | const RGB & | ) |
Create an HTML color string.
HTML color strings are of the form "#RRGGBB".
Create an ANSI color escape.
These characters can be emitted to an ANSI terminal after the appropriate escape sequence in order to change the foreground or background color. The escape sequence is usually "\033[38;2;" for the foreground and "\033[48;2;" for the background. The foreground and background colors can be canceled by emitting "\033[0m". If a layer is specified, then the escape sequence is part of the return value. ANSI doesn't support alphas, so if the alpha is less than 0.5 the return value is an empty string.
std::string Rose::Color::ansiColorEscape | ( | AnsiColor | ) |
ANSI color escape for terminal output.
Indexed by ColorName.