Loading...
Searching...
No Matches
Color Class Reference

A class representing terminal colors. More...

## Public Types

enum | Palette1 : uint8_t { Default }
enum | Palette16 : uint8_t { Black = 0 , Red = 1 , Green = 2 , Yellow = 3 , Blue = 4 , Magenta = 5 , Cyan = 6 , GrayLight = 7 , GrayDark = 8 , RedLight = 9 , GreenLight = 10 , YellowLight = 11 , BlueLight = 12 , MagentaLight = 13 , CyanLight = 14 , White = 15 }

enum

Palette256 : uint8_t {
Aquamarine1 = 122 , Aquamarine1Bis = 86 , Aquamarine3 = 79 , Blue1 = 21 ,
Blue3 = 19 , Blue3Bis = 20 , BlueViolet = 57 , CadetBlue = 72 ,
CadetBlueBis = 73 , Chartreuse1 = 118 , Chartreuse2 = 112 , Chartreuse2Bis = 82 ,
Chartreuse3 = 70 , Chartreuse3Bis = 76 , Chartreuse4 = 64 , CornflowerBlue = 69 ,
Cornsilk1 = 230 , Cyan1 = 51 , Cyan2 = 50 , Cyan3 = 43 ,
DarkBlue = 18 , DarkCyan = 36 , DarkGoldenrod = 136 , DarkGreen = 22 ,
DarkKhaki = 143 , DarkMagenta = 90 , DarkMagentaBis = 91 , DarkOliveGreen1 = 191 ,
DarkOliveGreen1Bis = 192 , DarkOliveGreen2 = 155 , DarkOliveGreen3 = 107 , DarkOliveGreen3Bis = 113 ,
DarkOliveGreen3Ter = 149 , DarkOrange = 208 , DarkOrange3 = 130 , DarkOrange3Bis = 166 ,
DarkRed = 52 , DarkRedBis = 88 , DarkSeaGreen = 108 , DarkSeaGreen1 = 158 ,
DarkSeaGreen1Bis = 193 , DarkSeaGreen2 = 151 , DarkSeaGreen2Bis = 157 , DarkSeaGreen3 = 115 ,
DarkSeaGreen3Bis = 150 , DarkSeaGreen4 = 65 , DarkSeaGreen4Bis = 71 , DarkSlateGray1 = 123 ,
DarkSlateGray2 = 87 , DarkSlateGray3 = 116 , DarkTurquoise = 44 , DarkViolet = 128 ,
DarkVioletBis = 92 , DeepPink1 = 198 , DeepPink1Bis = 199 , DeepPink2 = 197 ,
DeepPink3 = 161 , DeepPink3Bis = 162 , DeepPink4 = 125 , DeepPink4Bis = 89 ,
DeepPink4Ter = 53 , DeepSkyBlue1 = 39 , DeepSkyBlue2 = 38 , DeepSkyBlue3 = 31 ,
DeepSkyBlue3Bis = 32 , DeepSkyBlue4 = 23 , DeepSkyBlue4Bis = 24 , DeepSkyBlue4Ter = 25 ,
DodgerBlue1 = 33 , DodgerBlue2 = 27 , DodgerBlue3 = 26 , Gold1 = 220 ,
Gold3 = 142 , Gold3Bis = 178 , Green1 = 46 , Green3 = 34 ,
Green3Bis = 40 , Green4 = 28 , GreenYellow = 154 , Grey0 = 16 ,
Grey100 = 231 , Grey11 = 234 , Grey15 = 235 , Grey19 = 236 ,
Grey23 = 237 , Grey27 = 238 , Grey3 = 232 , Grey30 = 239 ,
Grey35 = 240 , Grey37 = 59 , Grey39 = 241 , Grey42 = 242 ,
Grey46 = 243 , Grey50 = 244 , Grey53 = 102 , Grey54 = 245 ,
Grey58 = 246 , Grey62 = 247 , Grey63 = 139 , Grey66 = 248 ,
Grey69 = 145 , Grey7 = 233 , Grey70 = 249 , Grey74 = 250 ,
Grey78 = 251 , Grey82 = 252 , Grey84 = 188 , Grey85 = 253 ,
Grey89 = 254 , Grey93 = 255 , Honeydew2 = 194 , HotPink = 205 ,
HotPink2 = 169 , HotPink3 = 132 , HotPink3Bis = 168 , HotPinkBis = 206 ,
IndianRed = 131 , IndianRed1 = 203 , IndianRed1Bis = 204 , IndianRedBis = 167 ,
Khaki1 = 228 , Khaki3 = 185 , LightCoral = 210 , LightCyan1Bis = 195 ,
LightCyan3 = 152 , LightGoldenrod1 = 227 , LightGoldenrod2 = 186 , LightGoldenrod2Bis = 221 ,
LightGoldenrod2Ter = 222 , LightGoldenrod3 = 179 , LightGreen = 119 , LightGreenBis = 120 ,
LightPink1 = 217 , LightPink3 = 174 , LightPink4 = 95 , LightSalmon1 = 216 ,
LightSalmon3 = 137 , LightSalmon3Bis = 173 , LightSeaGreen = 37 , LightSkyBlue1 = 153 ,
LightSkyBlue3 = 109 , LightSkyBlue3Bis = 110 , LightSlateBlue = 105 , LightSlateGrey = 103 ,
LightSteelBlue = 147 , LightSteelBlue1 = 189 , LightSteelBlue3 = 146 , LightYellow3 = 187 ,
Magenta1 = 201 , Magenta2 = 165 , Magenta2Bis = 200 , Magenta3 = 127 ,
Magenta3Bis = 163 , Magenta3Ter = 164 , MediumOrchid = 134 , MediumOrchid1 = 171 ,
MediumOrchid1Bis = 207 , MediumOrchid3 = 133 , MediumPurple = 104 , MediumPurple1 = 141 ,
MediumPurple2 = 135 , MediumPurple2Bis = 140 , MediumPurple3 = 97 , MediumPurple3Bis = 98 ,
MediumPurple4 = 60 , MediumSpringGreen = 49 , MediumTurquoise = 80 , MediumVioletRed = 126 ,
MistyRose1 = 224 , MistyRose3 = 181 , NavajoWhite1 = 223 , NavajoWhite3 = 144 ,
NavyBlue = 17 , Orange1 = 214 , Orange3 = 172 , Orange4 = 58 ,
Orange4Bis = 94 , OrangeRed1 = 202 , Orchid = 170 , Orchid1 = 213 ,
Orchid2 = 212 , PaleGreen1 = 121 , PaleGreen1Bis = 156 , PaleGreen3 = 114 ,
PaleGreen3Bis = 77 , PaleTurquoise1 = 159 , PaleTurquoise4 = 66 , PaleVioletRed1 = 211 ,
Pink1 = 218 , Pink3 = 175 , Plum1 = 219 , Plum2 = 183 ,
Plum3 = 176 , Plum4 = 96 , Purple = 129 , Purple3 = 56 ,
Purple4 = 54 , Purple4Bis = 55 , PurpleBis = 93 , Red1 = 196 ,
Red3 = 124 , Red3Bis = 160 , RosyBrown = 138 , RoyalBlue1 = 63 ,
Salmon1 = 209 , SandyBrown = 215 , SeaGreen1 = 84 , SeaGreen1Bis = 85 ,
SeaGreen2 = 83 , SeaGreen3 = 78 , SkyBlue1 = 117 , SkyBlue2 = 111 ,
SkyBlue3 = 74 , SlateBlue1 = 99 , SlateBlue3 = 61 , SlateBlue3Bis = 62 ,
SpringGreen1 = 48 , SpringGreen2 = 42 , SpringGreen2Bis = 47 , SpringGreen3 = 35 ,
SpringGreen3Bis = 41 , SpringGreen4 = 29 , SteelBlue = 67 , SteelBlue1 = 75 ,
SteelBlue1Bis = 81 , SteelBlue3 = 68 , Tan = 180 , Thistle1 = 225 ,
Thistle3 = 182 , Turquoise2 = 45 , Turquoise4 = 30 , Violet = 177 ,
Wheat1 = 229 , Wheat4 = 101 , Yellow1 = 226 , Yellow2 = 190 ,
Yellow3 = 148 , Yellow3Bis = 184 , Yellow4 = 100 , Yellow4Bis = 106
}

## Public Member Functions

| Color ()
| Build a transparent color.
| Color (Palette1 index)
| Build a transparent color.
| Color (Palette16 index)
| Build a color using the Palette16 colors.
| Color (Palette256 index)
| Build a color using Palette256 colors.
| Color (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha=255)
| Build a Color from its RGB representation. https://en.wikipedia.org/wiki/RGB_color_model.
bool | operator== (const Color &rhs) const
bool | operator!= (const Color &rhs) const
std::string | Print (bool is_background_color) const
bool | IsOpaque () const

## Static Public Member Functions

static Color | RGB (uint8_t red, uint8_t green, uint8_t blue)
| Build a Color from its RGB representation. https://en.wikipedia.org/wiki/RGB_color_model.
static Color | HSV (uint8_t hue, uint8_t saturation, uint8_t value)
| Build a Color from its HSV representation. https://en.wikipedia.org/wiki/HSL_and_HSV.
static Color | RGBA (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
| Build a Color from its RGBA representation. https://en.wikipedia.org/wiki/RGB_color_model.
static Color | HSVA (uint8_t hue, uint8_t saturation, uint8_t value, uint8_t alpha)
| Build a Color from its HSV representation. https://en.wikipedia.org/wiki/HSL_and_HSV.
static Color | Interpolate (float t, const Color &a, const Color &b)
static Color | Blend (const Color &lhs, const Color &rhs)
| Blend two colors together using the alpha channel.

## Detailed Description

A class representing terminal colors.

Examples
  examples/component/homescreen.cpp, examples/component/menu_entries.cpp, examples/component/menu_entries_animated.cpp, examples/dom/color_gallery.cpp, and examples/dom/color_info_palette256.cpp.

Definition at line 20 of file color.hpp.

## Member Enumeration Documentation

## Palette1

enum Palette1 : uint8_t

Enumerator
Default |

Definition at line 47 of file color.hpp.

## Palette16

enum Palette16 : uint8_t

Enumerator
Black |
Red |
Green |
Yellow |
Blue |
Magenta |
Cyan |
GrayLight |
GrayDark |
RedLight |
GreenLight |
YellowLight |
BlueLight |
MagentaLight |
CyanLight |
White |

Definition at line 51 of file color.hpp.

## Palette256

enum Palette256 : uint8_t

Enumerator
Aquamarine1 |
Aquamarine1Bis |
Aquamarine3 |
Blue1 |
Blue3 |
Blue3Bis |
BlueViolet |
CadetBlue |
CadetBlueBis |
Chartreuse1 |
Chartreuse2 |
Chartreuse2Bis |
Chartreuse3 |
Chartreuse3Bis |
Chartreuse4 |
CornflowerBlue |
Cornsilk1 |
Cyan1 |
Cyan2 |
Cyan3 |
DarkBlue |
DarkCyan |
DarkGoldenrod |
DarkGreen |
DarkKhaki |
DarkMagenta |
DarkMagentaBis |
DarkOliveGreen1 |
DarkOliveGreen1Bis |
DarkOliveGreen2 |
DarkOliveGreen3 |
DarkOliveGreen3Bis |
DarkOliveGreen3Ter |
DarkOrange |
DarkOrange3 |
DarkOrange3Bis |
DarkRed |
DarkRedBis |
DarkSeaGreen |
DarkSeaGreen1 |
DarkSeaGreen1Bis |
DarkSeaGreen2 |
DarkSeaGreen2Bis |
DarkSeaGreen3 |
DarkSeaGreen3Bis |
DarkSeaGreen4 |
DarkSeaGreen4Bis |
DarkSlateGray1 |
DarkSlateGray2 |
DarkSlateGray3 |
DarkTurquoise |
DarkViolet |
DarkVioletBis |
DeepPink1 |
DeepPink1Bis |
DeepPink2 |
DeepPink3 |
DeepPink3Bis |
DeepPink4 |
DeepPink4Bis |
DeepPink4Ter |
DeepSkyBlue1 |
DeepSkyBlue2 |
DeepSkyBlue3 |
DeepSkyBlue3Bis |
DeepSkyBlue4 |
DeepSkyBlue4Bis |
DeepSkyBlue4Ter |
DodgerBlue1 |
DodgerBlue2 |
DodgerBlue3 |
Gold1 |
Gold3 |
Gold3Bis |
Green1 |
Green3 |
Green3Bis |
Green4 |
GreenYellow |
Grey0 |
Grey100 |
Grey11 |
Grey15 |
Grey19 |
Grey23 |
Grey27 |
Grey3 |
Grey30 |
Grey35 |
Grey37 |
Grey39 |
Grey42 |
Grey46 |
Grey50 |
Grey53 |
Grey54 |
Grey58 |
Grey62 |
Grey63 |
Grey66 |
Grey69 |
Grey7 |
Grey70 |
Grey74 |
Grey78 |
Grey82 |
Grey84 |
Grey85 |
Grey89 |
Grey93 |
Honeydew2 |
HotPink |
HotPink2 |
HotPink3 |
HotPink3Bis |
HotPinkBis |
IndianRed |
IndianRed1 |
IndianRed1Bis |
IndianRedBis |
Khaki1 |
Khaki3 |
LightCoral |
LightCyan1Bis |
LightCyan3 |
LightGoldenrod1 |
LightGoldenrod2 |
LightGoldenrod2Bis |
LightGoldenrod2Ter |
LightGoldenrod3 |
LightGreen |
LightGreenBis |
LightPink1 |
LightPink3 |
LightPink4 |
LightSalmon1 |
LightSalmon3 |
LightSalmon3Bis |
LightSeaGreen |
LightSkyBlue1 |
LightSkyBlue3 |
LightSkyBlue3Bis |
LightSlateBlue |
LightSlateGrey |
LightSteelBlue |
LightSteelBlue1 |
LightSteelBlue3 |
LightYellow3 |
Magenta1 |
Magenta2 |
Magenta2Bis |
Magenta3 |
Magenta3Bis |
Magenta3Ter |
MediumOrchid |
MediumOrchid1 |
MediumOrchid1Bis |
MediumOrchid3 |
MediumPurple |
MediumPurple1 |
MediumPurple2 |
MediumPurple2Bis |
MediumPurple3 |
MediumPurple3Bis |
MediumPurple4 |
MediumSpringGreen |
MediumTurquoise |
MediumVioletRed |
MistyRose1 |
MistyRose3 |
NavajoWhite1 |
NavajoWhite3 |
NavyBlue |
Orange1 |
Orange3 |
Orange4 |
Orange4Bis |
OrangeRed1 |
Orchid |
Orchid1 |
Orchid2 |
PaleGreen1 |
PaleGreen1Bis |
PaleGreen3 |
PaleGreen3Bis |
PaleTurquoise1 |
PaleTurquoise4 |
PaleVioletRed1 |
Pink1 |
Pink3 |
Plum1 |
Plum2 |
Plum3 |
Plum4 |
Purple |
Purple3 |
Purple4 |
Purple4Bis |
PurpleBis |
Red1 |
Red3 |
Red3Bis |
RosyBrown |
RoyalBlue1 |
Salmon1 |
SandyBrown |
SeaGreen1 |
SeaGreen1Bis |
SeaGreen2 |
SeaGreen3 |
SkyBlue1 |
SkyBlue2 |
SkyBlue3 |
SlateBlue1 |
SlateBlue3 |
SlateBlue3Bis |
SpringGreen1 |
SpringGreen2 |
SpringGreen2Bis |
SpringGreen3 |
SpringGreen3Bis |
SpringGreen4 |
SteelBlue |
SteelBlue1 |
SteelBlue1Bis |
SteelBlue3 |
Tan |
Thistle1 |
Thistle3 |
Turquoise2 |
Turquoise4 |
Violet |
Wheat1 |
Wheat4 |
Yellow1 |
Yellow2 |
Yellow3 |
Yellow3Bis |
Yellow4 |
Yellow4Bis |

Examples
  examples/component/homescreen.cpp, examples/dom/color_gallery.cpp, and examples/dom/color_info_palette256.cpp.

Definition at line 70 of file color.hpp.

## Constructor & Destructor Documentation

## Color() [1/5]

Color | ( |  | ) |

default

Build a transparent color.

## Color() [2/5]

Color | ( | Palette1 | index | ) |

Build a transparent color.

Definition at line 82 of file color.cpp.

## Color() [3/5]

Color | ( | Palette16 | index | ) |

Build a color using the Palette16 colors.

Definition at line 86 of file color.cpp.

## Color() [4/5]

Color | ( | Palette256 | index | ) |

Build a color using Palette256 colors.

Definition at line 91 of file color.cpp.

## Color() [5/5]

Color | ( | uint8_t | red,
|  | uint8_t | green,
|  | uint8_t | blue,
|  | uint8_t | alpha = 255 )

Build a Color from its RGB representation. https://en.wikipedia.org/wiki/RGB_color_model.

Parameters

  red | The quantity of red [0,255]
  green | The quantity of green [0,255]
  blue | The quantity of blue [0,255]
  alpha | The quantity of alpha [0,255]

Definition at line 108 of file color.cpp.

## Member Function Documentation

## RGB()

Color RGB | ( | uint8_t | red,
|  | uint8_t | green,
|  | uint8_t | blue )

static

Build a Color from its RGB representation. https://en.wikipedia.org/wiki/RGB_color_model.

Parameters

  red | The quantity of red [0,255]
  green | The quantity of green [0,255]
  blue | The quantity of blue [0,255]

Examples
  examples/component/slider_rgb.cpp, and examples/dom/color_truecolor_RGB.cpp.

Definition at line 153 of file color.cpp.

## HSV()

Color HSV | ( | uint8_t | h,
|  | uint8_t | s,
|  | uint8_t | v )

static

Build a Color from its HSV representation. https://en.wikipedia.org/wiki/HSL_and_HSV.

Parameters

  h | The hue of the color [0,255]
  s | The "colorfulness" [0,255].
  v | The "Lightness" [0,255]

Examples
  examples/component/flexbox_gallery.cpp, examples/component/focus.cpp, examples/component/homescreen.cpp, examples/dom/color_gallery.cpp, and examples/dom/color_truecolor_HSV.cpp.

Definition at line 207 of file color.cpp.

## RGBA()

Color RGBA | ( | uint8_t | red,
|  | uint8_t | green,
|  | uint8_t | blue,
|  | uint8_t | alpha )

static

Build a Color from its RGBA representation. https://en.wikipedia.org/wiki/RGB_color_model.

Parameters

  red | The quantity of red [0,255]
  green | The quantity of green [0,255]
  blue | The quantity of blue [0,255]
  alpha | The quantity of alpha [0,255]

See also
  Color::RGB

Definition at line 166 of file color.cpp.

## HSVA()

Color HSVA | ( | uint8_t | h,
|  | uint8_t | s,
|  | uint8_t | v,
|  | uint8_t | alpha )

static

Build a Color from its HSV representation. https://en.wikipedia.org/wiki/HSL_and_HSV.

Parameters

  h | The hue of the color [0,255]
  s | The "colorfulness" [0,255].
  v | The "Lightness" [0,255]
  alpha | The quantity of alpha [0,255]

Definition at line 179 of file color.cpp.

## Interpolate()

Color Interpolate | ( | float | t,
|  | const Color & | a,
|  | const Color & | b )

static

Definition at line 212 of file color.cpp.

## Blend()

Color Blend | ( | const Color & | lhs,
|  | const Color & | rhs )

static

Blend two colors together using the alpha channel.

Definition at line 281 of file color.cpp.

## operator==()

bool operator== | ( | const Color & | rhs | ) | const

Definition at line 37 of file color.cpp.

## operator!=()

bool operator!= | ( | const Color & | rhs | ) | const

Definition at line 42 of file color.cpp.

## Print()

std::string Print | ( | bool | is_background_color | ) | const

Definition at line 46 of file color.cpp.

## IsOpaque()

bool IsOpaque | ( |  | ) | const

inline

Definition at line 319 of file color.hpp.

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

- include/ftxui/screen/color.hpp
- src/ftxui/screen/color.cpp