diff --git a/doc/example_list.md b/doc/example_list.md new file mode 100644 index 0000000..3b089bc --- /dev/null +++ b/doc/example_list.md @@ -0,0 +1,41 @@ +# Examples +@example ./examples/util/print_key_press.cpp +@example ./examples/dom/color_truecolor_HSV.cpp +@example ./examples/dom/dbox.cpp +@example ./examples/dom/separator.cpp +@example ./examples/dom/style_color.cpp +@example ./examples/dom/color_info_palette256.cpp +@example ./examples/dom/color_truecolor_RGB.cpp +@example ./examples/dom/paragraph.cpp +@example ./examples/dom/style_blink.cpp +@example ./examples/dom/style_dim.cpp +@example ./examples/dom/style_inverted.cpp +@example ./examples/dom/graph.cpp +@example ./examples/dom/package_manager.cpp +@example ./examples/dom/window.cpp +@example ./examples/dom/html_like.cpp +@example ./examples/dom/border.cpp +@example ./examples/dom/style_underlined.cpp +@example ./examples/dom/color_gallery.cpp +@example ./examples/dom/gauge.cpp +@example ./examples/dom/style_bold.cpp +@example ./examples/dom/spinner.cpp +@example ./examples/dom/style_gallery.cpp +@example ./examples/dom/vbox_hbox.cpp +@example ./examples/dom/size.cpp +@example ./examples/dom/hflow.cpp +@example ./examples/component/tab_vertical.cpp +@example ./examples/component/gallery.cpp +@example ./examples/component/checkbox.cpp +@example ./examples/component/checkbox_in_frame.cpp +@example ./examples/component/menu2.cpp +@example ./examples/component/tab_horizontal.cpp +@example ./examples/component/input.cpp +@example ./examples/component/homescreen.cpp +@example ./examples/component/radiobox.cpp +@example ./examples/component/menu.cpp +@example ./examples/component/menu_style.cpp +@example ./examples/component/radiobox_in_frame.cpp +@example ./examples/component/button.cpp +@example ./examples/component/toggle.cpp +@example ./examples/component/modal_dialog.cpp diff --git a/examples/dom/color_gallery.cpp b/examples/dom/color_gallery.cpp index a9c33b3..db1c25b 100644 --- a/examples/dom/color_gallery.cpp +++ b/examples/dom/color_gallery.cpp @@ -1,25 +1,21 @@ +#include #include +#include #include #include #include #include "ftxui/screen/string.hpp" -int main(int argc, const char* argv[]) { - using namespace ftxui; - // clang-format off - auto terminal_info = - vbox( - text(L"Basic Color support : unknown"), - text(L"256 Color support : unknown"), - (Terminal::CanSupportTrueColors() ? - text(L"TrueColor support : Yes"): - text(L"TrueColor support : No")) - ); +using namespace ftxui; +#include "./color_info_sorted_2d.ipp" // ColorInfoSorted2D. +int main(int argc, const char* argv[]) { + // clang-format off auto basic_color_display = vbox( - text(L"Basic Color Set:"), + text(L"16 color palette:"), + separator(), hbox( vbox( color(Color::Default, text(L"Default")), @@ -63,37 +59,68 @@ int main(int argc, const char* argv[]) { ); // clang-format on - auto palette_256_color_display = vbox(text(L"256 color palette:")); - - int y = -1; - for (int i = 0; i < 256; ++i) { - if (i % 16 == 0) { - palette_256_color_display->children.push_back(hbox()); - ++y; + auto palette_256_color_display = text(L"256 colors palette:"); + { + std::vector> info_columns = ColorInfoSorted2D(); + Elements columns; + for (auto& column : info_columns) { + Elements column_elements; + for (auto& it : column) { + column_elements.push_back( + text(L" ") | bgcolor(Color(Color::Palette256(it.index_256)))); + } + columns.push_back(hbox(std::move(column_elements))); } - std::string number = std::to_string(i); - while (number.length() < 4) { - number.push_back(' '); - } - palette_256_color_display->children.back()->children.push_back( - bgcolor(Color::Palette256(i), text(to_wstring(number)))); + palette_256_color_display = vbox({ + palette_256_color_display, + separator(), + vbox(columns), + }); } - auto true_color_display = vbox(text(L"a true color grandient:")); - - for (int i = 0; i < 17; ++i) { - true_color_display->children.push_back(hbox()); - - for (int j = 0; j < 30; ++j) { - true_color_display->children.back()->children.push_back( - bgcolor(Color(50 + i * 5, 100 + j, 150), text(L" "))); + // True color display. + auto true_color_display = text(L"TrueColors: 24bits:"); + { + int saturation = 255; + Elements array; + for (int value = 0; value < 255; value += 16) { + Elements line; + for (int hue = 0; hue < 255; hue += 6) { + line.push_back(text(L"▀") // + | color(Color::HSV(hue, saturation, value)) // + | bgcolor(Color::HSV(hue, saturation, value + 8))); + } + array.push_back(hbox(std::move(line))); } + true_color_display = vbox({ + true_color_display, + separator(), + vbox(std::move(array)), + }); } - auto document = - vbox(terminal_info, text(L""), - hbox(basic_color_display, text(L" "), palette_256_color_display, - text(L" "), true_color_display)); + auto terminal_info = + vbox({ + Terminal::ColorSupport() >= Terminal::Color::Palette16 + ? text(L" 16 color palette support : Yes") + : text(L" 16 color palette support : No"), + Terminal::ColorSupport() >= Terminal::Color::Palette256 + ? text(L"256 color palette support : Yes") + : text(L"256 color palette support : No"), + Terminal::ColorSupport() >= Terminal::Color::TrueColor + ? text(L" True color support : Yes") + : text(L" True color support : No"), + }) | + border; + + auto document = vbox({hbox({ + basic_color_display, + text(L" "), + palette_256_color_display, + text(L" "), + true_color_display, + }), + terminal_info}); // clang-format on auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document)); diff --git a/examples/dom/color_info_palette256.cpp b/examples/dom/color_info_palette256.cpp index 1352877..56820f3 100644 --- a/examples/dom/color_info_palette256.cpp +++ b/examples/dom/color_info_palette256.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -6,54 +7,11 @@ #include #include "ftxui/screen/string.hpp" +using namespace ftxui; +#include "./color_info_sorted_2d.ipp" // ColorInfoSorted2D. + int main(int argc, const char* argv[]) { - using namespace ftxui; - - // Acquire the color information for the palette256. - std::vector info_gray; - std::vector info_color; - for (int i = 0; i < 256; ++i) { - ColorInfo info = GetColorInfo(Color::Palette256(i)); - if (info.saturation == 0) - info_gray.push_back(info); - else - info_color.push_back(info); - } - - // Sort info_color by hue. - std::sort( - info_color.begin(), info_color.end(), - [](const ColorInfo& A, const ColorInfo& B) { return A.hue < B.hue; }); - - // Make 8 colums, one gray and seven colored. - std::vector> info_columns(8); - info_columns[0] = info_gray; - for (int i = 0; i < info_color.size(); ++i) { - info_columns[1 + 7 * i / info_color.size()].push_back(info_color[i]); - } - - // Minimize discontinuities for every columns. - for (auto& column : info_columns) { - std::sort(column.begin(), column.end(), - [](const ColorInfo& A, const ColorInfo& B) { - return A.value < B.value; - }); - for (int i = 0; i < column.size() - 1; ++i) { - int best_index = i + 1; - int best_distance = 255 * 255 * 3; - for (int j = i + 1; j < column.size(); ++j) { - int dx = column[i].red - column[j].red; - int dy = column[i].green - column[j].green; - int dz = column[i].blue - column[j].blue; - int distance = dx * dx + dy * dy + dz * dz; - if (best_distance > distance) { - best_distance = distance; - best_index = j; - } - } - std::swap(column[i + 1], column[best_index]); - } - } + std::vector> info_columns = ColorInfoSorted2D(); // Draw every columns Elements columns_elements; @@ -61,7 +19,7 @@ int main(int argc, const char* argv[]) { Elements column_elements; for (auto& it : column) { column_elements.push_back(hbox({ - text(L" ") | bgcolor(Color(Color::Palette256(it.index))), + text(L" ") | bgcolor(Color(Color::Palette256(it.index_256))), text(to_wstring(std::string(it.name))), })); } diff --git a/examples/dom/color_info_sorted_2d.ipp b/examples/dom/color_info_sorted_2d.ipp new file mode 100644 index 0000000..6e5119d --- /dev/null +++ b/examples/dom/color_info_sorted_2d.ipp @@ -0,0 +1,52 @@ +#include +#include + +std::vector> ColorInfoSorted2D() { + // Acquire the color information for the palette256. + std::vector info_gray; + std::vector info_color; + for (int i = 16; i < 256; ++i) { + ColorInfo info = GetColorInfo(Color::Palette256(i)); + if (info.saturation == 0) + info_gray.push_back(info); + else + info_color.push_back(info); + } + + // Sort info_color by hue. + std::sort( + info_color.begin(), info_color.end(), + [](const ColorInfo& A, const ColorInfo& B) { return A.hue < B.hue; }); + + // Make 8 colums, one gray and seven colored. + std::vector> info_columns(8); + info_columns[0] = info_gray; + for (int i = 0; i < info_color.size(); ++i) { + info_columns[1 + 7 * i / info_color.size()].push_back(info_color[i]); + } + + // Minimize discontinuities for every columns. + for (auto& column : info_columns) { + std::sort(column.begin(), column.end(), + [](const ColorInfo& A, const ColorInfo& B) { + return A.value < B.value; + }); + for (int i = 0; i < column.size() - 1; ++i) { + int best_index = i + 1; + int best_distance = 255 * 255 * 3; + for (int j = i + 1; j < column.size(); ++j) { + int dx = column[i].red - column[j].red; + int dy = column[i].green - column[j].green; + int dz = column[i].blue - column[j].blue; + int distance = dx * dx + dy * dy + dz * dz; + if (best_distance > distance) { + best_distance = distance; + best_index = j; + } + } + std::swap(column[i + 1], column[best_index]); + } + } + + return std::move(info_columns); +} diff --git a/examples/dom/color_truecolor_HSV.cpp b/examples/dom/color_truecolor_HSV.cpp index ba6ae7a..887f27c 100644 --- a/examples/dom/color_truecolor_HSV.cpp +++ b/examples/dom/color_truecolor_HSV.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -10,10 +11,13 @@ int main(int argc, const char* argv[]) { int saturation = 255; Elements array; - for (int value = 0; value < 255; value += 10) { + for (int value = 0; value < 255; value += 20) { Elements line; - for (int hue = 0; hue < 255; hue += 2) - line.push_back(text(L" ") | bgcolor(Color::HSV(hue, saturation, value))); + for (int hue = 0; hue < 255; hue += 2) { + line.push_back(text(L"▀") // + | color(Color::HSV(hue, saturation, value)) // + | bgcolor(Color::HSV(hue, saturation, value + 10))); + } array.push_back(hbox(std::move(line))); } diff --git a/examples/dom/window.cpp b/examples/dom/window.cpp index 7999c57..18726da 100644 --- a/examples/dom/window.cpp +++ b/examples/dom/window.cpp @@ -2,12 +2,21 @@ #include #include -int main(int argc, const char* argv[]) { +int main(void) { using namespace ftxui; - auto document = window(text(L"Title"), text(L"content")); - auto screen = Screen::Create(Dimension::Fixed(30), Dimension::Fixed(6)); + Element document = graph([](int x, int y) { + std::vector result(x, 0); + for (int i{0}; i < x; ++i) { + result[i] = ((3 * i) / 2) % y; + } + return result; + }) | + color(Color::Red) | border | color(Color::Green) | + bgcolor(Color::DarkBlue); + + auto screen = Screen::Create(Dimension::Fixed(80), Dimension::Fixed(10)); Render(screen, document); - std::cout << screen.ToString() << std::endl; + std::cout << screen.ToString() << '\n'; } // Copyright 2020 Arthur Sonzogni. All rights reserved. diff --git a/include/ftxui/screen/color.hpp b/include/ftxui/screen/color.hpp index a32b1f4..84bd936 100644 --- a/include/ftxui/screen/color.hpp +++ b/include/ftxui/screen/color.hpp @@ -10,10 +10,12 @@ namespace ftxui { /// @ingroup screen class Color { public: + enum Palette1 : uint8_t; enum Palette16 : uint8_t; enum Palette256 : uint8_t; Color(); // Transparent. + Color(Palette1 index); // Transparent. Color(Palette16 index); // Implicit conversion from index to Color. Color(Palette256 index); // Implicit conversion from index to Color. Color(uint8_t red, uint8_t green, uint8_t blue); @@ -23,26 +25,28 @@ class Color { //--------------------------- // List of colors: //--------------------------- - // clang-format off + enum Palette1 : uint8_t{ + Default, // Transparent + }; + enum Palette16 : uint8_t { - Black = 30, - Blue = 34, - BlueLight = 94, - Cyan = 36, - CyanLight = 96, - Default = 39, // Transparent - GrayDark = 90, - GrayLight = 37, - Green = 32, - GreenLight = 92, - Magenta = 35, - MagentaLight = 95, - Red = 31, - RedLight = 91, - White = 97, - Yellow = 33, - YellowLight = 93, + 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 { @@ -297,6 +301,7 @@ class Color { private: enum class ColorType : uint8_t { + Palette1, Palette16, Palette256, TrueColor, diff --git a/include/ftxui/screen/color_info.hpp b/include/ftxui/screen/color_info.hpp index 2364122..b3c64ca 100644 --- a/include/ftxui/screen/color_info.hpp +++ b/include/ftxui/screen/color_info.hpp @@ -7,7 +7,8 @@ namespace ftxui { struct ColorInfo { const char* name; - uint8_t index; + uint8_t index_256; + uint8_t index_16; uint8_t red; uint8_t green; uint8_t blue; @@ -17,6 +18,7 @@ struct ColorInfo { }; ColorInfo GetColorInfo(Color::Palette256 index); +ColorInfo GetColorInfo(Color::Palette16 index); } // namespace ftxui diff --git a/include/ftxui/screen/terminal.hpp b/include/ftxui/screen/terminal.hpp index 39c2fdf..3bb7a13 100644 --- a/include/ftxui/screen/terminal.hpp +++ b/include/ftxui/screen/terminal.hpp @@ -9,10 +9,15 @@ class Terminal { int dimx; int dimy; }; - - static bool CanSupportTrueColors(); - static Dimensions Size(); + + enum Color { + Palette1, + Palette16, + Palette256, + TrueColor, + }; + static Color ColorSupport(); }; } // namespace ftxui diff --git a/src/ftxui/screen/color.cpp b/src/ftxui/screen/color.cpp index cbe7735..f2de941 100644 --- a/src/ftxui/screen/color.cpp +++ b/src/ftxui/screen/color.cpp @@ -6,6 +6,18 @@ namespace ftxui { +namespace { +const wchar_t* palette16code[16][2] = { + {L"30", L"40"}, {L"31", L"41"}, {L"32", L"42"}, {L"33", L"43"}, + {L"34", L"44"}, + + {L"35", L"45"}, {L"36", L"46"}, {L"37", L"47"}, + + {L"90", L"100"}, {L"91", L"101"}, {L"92", L"102"}, {L"93", L"103"}, + {L"94", L"104"}, {L"95", L"105"}, {L"96", L"106"}, {L"97", L"107"}, +}; +} + bool Color::operator==(const Color& rhs) const { return red_ == rhs.red_ && green_ == rhs.green_ && blue_ == rhs.blue_ && type_ == rhs.type_; @@ -17,28 +29,31 @@ bool Color::operator!=(const Color& rhs) const { std::wstring Color::Print(bool is_background_color) const { switch (type_) { + case ColorType::Palette1: + return is_background_color ? L"49" : L"39"; + case ColorType::Palette16: - return to_wstring( - std::to_string((is_background_color ? 10 : 0) + index_)); + return palette16code[index_][is_background_color]; case ColorType::Palette256: - return to_wstring(std::to_string(is_background_color ? 48 : 38) // - + ";5;" // - + std::to_string(index_)); // + return (is_background_color ? L"48;5;" : L"38;5") + to_wstring(index_); case ColorType::TrueColor: - return to_wstring(std::to_string(is_background_color ? 48 : 38) // - + ";2;" // - + std::to_string(red_) + ";" // - + std::to_string(green_) + ";" // - + std::to_string(blue_)); // + return (is_background_color ? L"48;2;" : L"38;2;") // + + to_wstring(red_) + L";" // + + to_wstring(green_) + L";" // + + to_wstring(blue_); // } return L""; } /// @brief Build a transparent color. /// @ingroup screen -Color::Color() : type_(ColorType::Palette16), index_(Palette16::Default) {} +Color::Color() : type_(ColorType::Palette1) {} + +/// @brief Build a transparent color. +/// @ingroup screen +Color::Color(Palette1) : type_(ColorType::Palette1) {} /// @brief Build a transparent using Palette16 colors. /// @ingroup screen diff --git a/src/ftxui/screen/color_info.cpp b/src/ftxui/screen/color_info.cpp index 184bec7..2a12a2f 100644 --- a/src/ftxui/screen/color_info.cpp +++ b/src/ftxui/screen/color_info.cpp @@ -4,267 +4,271 @@ namespace ftxui { // clang-format off const ColorInfo palette256[] = { - {"Black" , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , - {"Maroon" , 1 , 128 , 0 , 0 , 0 , 255 , 128 } , - {"Green" , 2 , 0 , 128 , 0 , 85 , 255 , 128 } , - {"Olive" , 3 , 128 , 128 , 0 , 43 , 255 , 128 } , - {"Navy" , 4 , 0 , 0 , 128 , 171 , 255 , 128 } , - {"Purple" , 5 , 128 , 0 , 128 , 213 , 255 , 128 } , - {"Teal" , 6 , 0 , 128 , 128 , 128 , 255 , 128 } , - {"Silver" , 7 , 192 , 192 , 192 , 0 , 0 , 192 } , - {"Grey" , 8 , 128 , 128 , 128 , 0 , 0 , 128 } , - {"Red" , 9 , 255 , 0 , 0 , 0 , 255 , 255 } , - {"Lime" , 10 , 0 , 255 , 0 , 85 , 255 , 255 } , - {"Yellow" , 11 , 255 , 255 , 0 , 43 , 255 , 255 } , - {"Blue" , 12 , 0 , 0 , 255 , 171 , 255 , 255 } , - {"Fuchsia" , 13 , 255 , 0 , 255 , 213 , 255 , 255 } , - {"Aqua" , 14 , 0 , 255 , 255 , 128 , 255 , 255 } , - {"White" , 15 , 255 , 255 , 255 , 0 , 0 , 255 } , - {"Grey0" , 16 , 0 , 0 , 0 , 0 , 0 , 0 } , - {"NavyBlue" , 17 , 0 , 0 , 95 , 171 , 255 , 95 } , - {"DarkBlue" , 18 , 0 , 0 , 135 , 171 , 255 , 135 } , - {"Blue3" , 19 , 0 , 0 , 175 , 171 , 255 , 175 } , - {"Blue3Bis" , 20 , 0 , 0 , 215 , 171 , 255 , 215 } , - {"Blue1" , 21 , 0 , 0 , 255 , 171 , 255 , 255 } , - {"DarkGreen" , 22 , 0 , 95 , 0 , 85 , 255 , 95 } , - {"DeepSkyBlue4" , 23 , 0 , 95 , 95 , 128 , 255 , 95 } , - {"DeepSkyBlue4Bis" , 24 , 0 , 95 , 135 , 141 , 255 , 135 } , - {"DeepSkyBlue4Ter" , 25 , 0 , 95 , 175 , 148 , 255 , 175 } , - {"DodgerBlue3" , 26 , 0 , 95 , 215 , 152 , 255 , 215 } , - {"DodgerBlue2" , 27 , 0 , 95 , 255 , 155 , 255 , 255 } , - {"Green4" , 28 , 0 , 135 , 0 , 85 , 255 , 135 } , - {"SpringGreen4" , 29 , 0 , 135 , 95 , 115 , 255 , 135 } , - {"Turquoise4" , 30 , 0 , 135 , 135 , 128 , 255 , 135 } , - {"DeepSkyBlue3" , 31 , 0 , 135 , 175 , 138 , 255 , 175 } , - {"DeepSkyBlue3Bis" , 32 , 0 , 135 , 215 , 144 , 255 , 215 } , - {"DodgerBlue1" , 33 , 0 , 135 , 255 , 149 , 255 , 255 } , - {"Green3" , 34 , 0 , 175 , 0 , 85 , 255 , 175 } , - {"SpringGreen3" , 35 , 0 , 175 , 95 , 108 , 255 , 175 } , - {"DarkCyan" , 36 , 0 , 175 , 135 , 118 , 255 , 175 } , - {"LightSeaGreen" , 37 , 0 , 175 , 175 , 128 , 255 , 175 } , - {"DeepSkyBlue2" , 38 , 0 , 175 , 215 , 136 , 255 , 215 } , - {"DeepSkyBlue1" , 39 , 0 , 175 , 255 , 142 , 255 , 255 } , - {"Green3Bis" , 40 , 0 , 215 , 0 , 85 , 255 , 215 } , - {"SpringGreen3Bis" , 41 , 0 , 215 , 95 , 104 , 255 , 215 } , - {"SpringGreen2" , 42 , 0 , 215 , 135 , 112 , 255 , 215 } , - {"Cyan3" , 43 , 0 , 215 , 175 , 120 , 255 , 215 } , - {"DarkTurquoise" , 44 , 0 , 215 , 215 , 128 , 255 , 215 } , - {"Turquoise2" , 45 , 0 , 215 , 255 , 135 , 255 , 255 } , - {"Green1" , 46 , 0 , 255 , 0 , 85 , 255 , 255 } , - {"SpringGreen2Bis" , 47 , 0 , 255 , 95 , 101 , 255 , 255 } , - {"SpringGreen1" , 48 , 0 , 255 , 135 , 107 , 255 , 255 } , - {"MediumSpringGreen" , 49 , 0 , 255 , 175 , 114 , 255 , 255 } , - {"Cyan2" , 50 , 0 , 255 , 215 , 121 , 255 , 255 } , - {"Cyan1" , 51 , 0 , 255 , 255 , 128 , 255 , 255 } , - {"DarkRed" , 52 , 95 , 0 , 0 , 0 , 255 , 95 } , - {"DeepPink4Ter" , 53 , 95 , 0 , 95 , 213 , 255 , 95 } , - {"Purple4" , 54 , 95 , 0 , 135 , 201 , 255 , 135 } , - {"Purple4Bis" , 55 , 95 , 0 , 175 , 194 , 255 , 175 } , - {"Purple3" , 56 , 95 , 0 , 215 , 190 , 255 , 215 } , - {"BlueViolet" , 57 , 95 , 0 , 255 , 187 , 255 , 255 } , - {"Orange4" , 58 , 95 , 95 , 0 , 43 , 255 , 95 } , - {"Grey37" , 59 , 95 , 95 , 95 , 0 , 0 , 95 } , - {"MediumPurple4" , 60 , 95 , 95 , 135 , 171 , 75 , 135 } , - {"SlateBlue3" , 61 , 95 , 95 , 175 , 171 , 116 , 175 } , - {"SlateBlue3Bis" , 62 , 95 , 95 , 215 , 171 , 142 , 215 } , - {"RoyalBlue1" , 63 , 95 , 95 , 255 , 171 , 160 , 255 } , - {"Chartreuse4" , 64 , 95 , 135 , 0 , 55 , 255 , 135 } , - {"DarkSeaGreen4" , 65 , 95 , 135 , 95 , 85 , 75 , 135 } , - {"PaleTurquoise4" , 66 , 95 , 135 , 135 , 128 , 75 , 135 } , - {"SteelBlue" , 67 , 95 , 135 , 175 , 150 , 116 , 175 } , - {"SteelBlue3" , 68 , 95 , 135 , 215 , 157 , 142 , 215 } , - {"CornflowerBlue" , 69 , 95 , 135 , 255 , 161 , 160 , 255 } , - {"Chartreuse3" , 70 , 95 , 175 , 0 , 62 , 255 , 175 } , - {"DarkSeaGreen4Bis" , 71 , 95 , 175 , 95 , 85 , 116 , 175 } , - {"CadetBlue" , 72 , 95 , 175 , 135 , 106 , 116 , 175 } , - {"CadetBlueBis" , 73 , 95 , 175 , 175 , 128 , 116 , 175 } , - {"SkyBlue3" , 74 , 95 , 175 , 215 , 143 , 142 , 215 } , - {"SteelBlue1" , 75 , 95 , 175 , 255 , 150 , 160 , 255 } , - {"Chartreuse3Bis" , 76 , 95 , 215 , 0 , 66 , 255 , 215 } , - {"PaleGreen3Bis" , 77 , 95 , 215 , 95 , 85 , 142 , 215 } , - {"SeaGreen3" , 78 , 95 , 215 , 135 , 99 , 142 , 215 } , - {"Aquamarine3" , 79 , 95 , 215 , 175 , 113 , 142 , 215 } , - {"MediumTurquoise" , 80 , 95 , 215 , 215 , 128 , 142 , 215 } , - {"SteelBlue1Bis" , 81 , 95 , 215 , 255 , 139 , 160 , 255 } , - {"Chartreuse2Bis" , 82 , 95 , 255 , 0 , 69 , 255 , 255 } , - {"SeaGreen2" , 83 , 95 , 255 , 95 , 85 , 160 , 255 } , - {"SeaGreen1" , 84 , 95 , 255 , 135 , 95 , 160 , 255 } , - {"SeaGreen1Bis" , 85 , 95 , 255 , 175 , 106 , 160 , 255 } , - {"Aquamarine1Bis" , 86 , 95 , 255 , 215 , 117 , 160 , 255 } , - {"DarkSlateGray2" , 87 , 95 , 255 , 255 , 128 , 160 , 255 } , - {"DarkRedBis" , 88 , 135 , 0 , 0 , 0 , 255 , 135 } , - {"DeepPink4Bis" , 89 , 135 , 0 , 95 , 226 , 255 , 135 } , - {"DarkMagenta" , 90 , 135 , 0 , 135 , 213 , 255 , 135 } , - {"DarkMagentaBis" , 91 , 135 , 0 , 175 , 204 , 255 , 175 } , - {"DarkVioletBis" , 92 , 135 , 0 , 215 , 198 , 255 , 215 } , - {"PurpleBis" , 93 , 135 , 0 , 255 , 193 , 255 , 255 } , - {"Orange4Bis" , 94 , 135 , 95 , 0 , 30 , 255 , 135 } , - {"LightPink4" , 95 , 135 , 95 , 95 , 0 , 75 , 135 } , - {"Plum4" , 96 , 135 , 95 , 135 , 213 , 75 , 135 } , - {"MediumPurple3" , 97 , 135 , 95 , 175 , 192 , 116 , 175 } , - {"MediumPurple3Bis" , 98 , 135 , 95 , 215 , 185 , 142 , 215 } , - {"SlateBlue1" , 99 , 135 , 95 , 255 , 181 , 160 , 255 } , - {"Yellow4" , 100 , 135 , 135 , 0 , 43 , 255 , 135 } , - {"Wheat4" , 101 , 135 , 135 , 95 , 43 , 75 , 135 } , - {"Grey53" , 102 , 135 , 135 , 135 , 0 , 0 , 135 } , - {"LightSlateGrey" , 103 , 135 , 135 , 175 , 171 , 58 , 175 } , - {"MediumPurple" , 104 , 135 , 135 , 215 , 171 , 94 , 215 } , - {"LightSlateBlue" , 105 , 135 , 135 , 255 , 171 , 120 , 255 } , - {"Yellow4Bis" , 106 , 135 , 175 , 0 , 52 , 255 , 175 } , - {"DarkOliveGreen3" , 107 , 135 , 175 , 95 , 64 , 116 , 175 } , - {"DarkSeaGreen" , 108 , 135 , 175 , 135 , 85 , 58 , 175 } , - {"LightSkyBlue3" , 109 , 135 , 175 , 175 , 128 , 58 , 175 } , - {"LightSkyBlue3Bis" , 110 , 135 , 175 , 215 , 150 , 94 , 215 } , - {"SkyBlue2" , 111 , 135 , 175 , 255 , 157 , 120 , 255 } , - {"Chartreuse2" , 112 , 135 , 215 , 0 , 58 , 255 , 215 } , - {"DarkOliveGreen3Bis" , 113 , 135 , 215 , 95 , 71 , 142 , 215 } , - {"PaleGreen3" , 114 , 135 , 215 , 135 , 85 , 94 , 215 } , - {"DarkSeaGreen3" , 115 , 135 , 215 , 175 , 106 , 94 , 215 } , - {"DarkSlateGray3" , 116 , 135 , 215 , 215 , 128 , 94 , 215 } , - {"SkyBlue1" , 117 , 135 , 215 , 255 , 143 , 120 , 255 } , - {"Chartreuse1" , 118 , 135 , 255 , 0 , 63 , 255 , 255 } , - {"LightGreen" , 119 , 135 , 255 , 95 , 75 , 160 , 255 } , - {"LightGreenBis" , 120 , 135 , 255 , 135 , 85 , 120 , 255 } , - {"PaleGreen1" , 121 , 135 , 255 , 175 , 99 , 120 , 255 } , - {"Aquamarine1" , 122 , 135 , 255 , 215 , 113 , 120 , 255 } , - {"DarkSlateGray1" , 123 , 135 , 255 , 255 , 128 , 120 , 255 } , - {"Red3" , 124 , 175 , 0 , 0 , 0 , 255 , 175 } , - {"DeepPink4" , 125 , 175 , 0 , 95 , 233 , 255 , 175 } , - {"MediumVioletRed" , 126 , 175 , 0 , 135 , 223 , 255 , 175 } , - {"Magenta3" , 127 , 175 , 0 , 175 , 213 , 255 , 175 } , - {"DarkViolet" , 128 , 175 , 0 , 215 , 206 , 255 , 215 } , - {"Purple" , 129 , 175 , 0 , 255 , 200 , 255 , 255 } , - {"DarkOrange3" , 130 , 175 , 95 , 0 , 23 , 255 , 175 } , - {"IndianRed" , 131 , 175 , 95 , 95 , 0 , 116 , 175 } , - {"HotPink3" , 132 , 175 , 95 , 135 , 235 , 116 , 175 } , - {"MediumOrchid3" , 133 , 175 , 95 , 175 , 213 , 116 , 175 } , - {"MediumOrchid" , 134 , 175 , 95 , 215 , 199 , 142 , 215 } , - {"MediumPurple2" , 135 , 175 , 95 , 255 , 192 , 160 , 255 } , - {"DarkGoldenrod" , 136 , 175 , 135 , 0 , 33 , 255 , 175 } , - {"LightSalmon3" , 137 , 175 , 135 , 95 , 21 , 116 , 175 } , - {"RosyBrown" , 138 , 175 , 135 , 135 , 0 , 58 , 175 } , - {"Grey63" , 139 , 175 , 135 , 175 , 213 , 58 , 175 } , - {"MediumPurple2Bis" , 140 , 175 , 135 , 215 , 192 , 94 , 215 } , - {"MediumPurple1" , 141 , 175 , 135 , 255 , 185 , 120 , 255 } , - {"Gold3" , 142 , 175 , 175 , 0 , 43 , 255 , 175 } , - {"DarkKhaki" , 143 , 175 , 175 , 95 , 43 , 116 , 175 } , - {"NavajoWhite3" , 144 , 175 , 175 , 135 , 43 , 58 , 175 } , - {"Grey69" , 145 , 175 , 175 , 175 , 0 , 0 , 175 } , - {"LightSteelBlue3" , 146 , 175 , 175 , 215 , 171 , 47 , 215 } , - {"LightSteelBlue" , 147 , 175 , 175 , 255 , 171 , 80 , 255 } , - {"Yellow3" , 148 , 175 , 215 , 0 , 50 , 255 , 215 } , - {"DarkOliveGreen3Ter" , 149 , 175 , 215 , 95 , 57 , 142 , 215 } , - {"DarkSeaGreen3Bis" , 150 , 175 , 215 , 135 , 64 , 94 , 215 } , - {"DarkSeaGreen2" , 151 , 175 , 215 , 175 , 85 , 47 , 215 } , - {"LightCyan3" , 152 , 175 , 215 , 215 , 128 , 47 , 215 } , - {"LightSkyBlue1" , 153 , 175 , 215 , 255 , 150 , 80 , 255 } , - {"GreenYellow" , 154 , 175 , 255 , 0 , 56 , 255 , 255 } , - {"DarkOliveGreen2" , 155 , 175 , 255 , 95 , 64 , 160 , 255 } , - {"PaleGreen1Bis" , 156 , 175 , 255 , 135 , 71 , 120 , 255 } , - {"DarkSeaGreen2Bis" , 157 , 175 , 255 , 175 , 85 , 80 , 255 } , - {"DarkSeaGreen1" , 158 , 175 , 255 , 215 , 106 , 80 , 255 } , - {"PaleTurquoise1" , 159 , 175 , 255 , 255 , 128 , 80 , 255 } , - {"Red3Bis" , 160 , 215 , 0 , 0 , 0 , 255 , 215 } , - {"DeepPink3" , 161 , 215 , 0 , 95 , 237 , 255 , 215 } , - {"DeepPink3Bis" , 162 , 215 , 0 , 135 , 229 , 255 , 215 } , - {"Magenta3Bis" , 163 , 215 , 0 , 175 , 221 , 255 , 215 } , - {"Magenta3Ter" , 164 , 215 , 0 , 215 , 213 , 255 , 215 } , - {"Magenta2" , 165 , 215 , 0 , 255 , 207 , 255 , 255 } , - {"DarkOrange3Bis" , 166 , 215 , 95 , 0 , 19 , 255 , 215 } , - {"IndianRedBis" , 167 , 215 , 95 , 95 , 0 , 142 , 215 } , - {"HotPink3Bis" , 168 , 215 , 95 , 135 , 242 , 142 , 215 } , - {"HotPink2" , 169 , 215 , 95 , 175 , 228 , 142 , 215 } , - {"Orchid" , 170 , 215 , 95 , 215 , 213 , 142 , 215 } , - {"MediumOrchid1" , 171 , 215 , 95 , 255 , 203 , 160 , 255 } , - {"Orange3" , 172 , 215 , 135 , 0 , 27 , 255 , 215 } , - {"LightSalmon3" , 173 , 215 , 135 , 95 , 14 , 142 , 215 } , - {"LightPink3" , 174 , 215 , 135 , 135 , 0 , 94 , 215 } , - {"Pink3" , 175 , 215 , 135 , 175 , 235 , 94 , 215 } , - {"Plum3" , 176 , 215 , 135 , 215 , 213 , 94 , 215 } , - {"Violet" , 177 , 215 , 135 , 255 , 199 , 120 , 255 } , - {"Gold3Bis" , 178 , 215 , 175 , 0 , 35 , 255 , 215 } , - {"LightGoldenrod3" , 179 , 215 , 175 , 95 , 28 , 142 , 215 } , - {"Tan" , 180 , 215 , 175 , 135 , 21 , 94 , 215 } , - {"MistyRose3" , 181 , 215 , 175 , 175 , 0 , 47 , 215 } , - {"Thistle3" , 182 , 215 , 175 , 215 , 213 , 47 , 215 } , - {"Plum2" , 183 , 215 , 175 , 255 , 192 , 80 , 255 } , - {"Yellow3Bis" , 184 , 215 , 215 , 0 , 43 , 255 , 215 } , - {"Khaki3" , 185 , 215 , 215 , 95 , 43 , 142 , 215 } , - {"LightGoldenrod2" , 186 , 215 , 215 , 135 , 43 , 94 , 215 } , - {"LightYellow3" , 187 , 215 , 215 , 175 , 43 , 47 , 215 } , - {"Grey84" , 188 , 215 , 215 , 215 , 0 , 0 , 215 } , - {"LightSteelBlue1" , 189 , 215 , 215 , 255 , 171 , 40 , 255 } , - {"Yellow2" , 190 , 215 , 255 , 0 , 49 , 255 , 255 } , - {"DarkOliveGreen1" , 191 , 215 , 255 , 95 , 53 , 160 , 255 } , - {"DarkOliveGreen1Bis" , 192 , 215 , 255 , 135 , 57 , 120 , 255 } , - {"DarkSeaGreen1Bis" , 193 , 215 , 255 , 175 , 64 , 80 , 255 } , - {"Honeydew2" , 194 , 215 , 255 , 215 , 85 , 40 , 255 } , - {"LightCyan1Bis" , 195 , 215 , 255 , 255 , 128 , 40 , 255 } , - {"Red1" , 196 , 255 , 0 , 0 , 0 , 255 , 255 } , - {"DeepPink2" , 197 , 255 , 0 , 95 , 240 , 255 , 255 } , - {"DeepPink1" , 198 , 255 , 0 , 135 , 234 , 255 , 255 } , - {"DeepPink1Bis" , 199 , 255 , 0 , 175 , 227 , 255 , 255 } , - {"Magenta2Bis" , 200 , 255 , 0 , 215 , 220 , 255 , 255 } , - {"Magenta1" , 201 , 255 , 0 , 255 , 213 , 255 , 255 } , - {"OrangeRed1" , 202 , 255 , 95 , 0 , 16 , 255 , 255 } , - {"IndianRed1" , 203 , 255 , 95 , 95 , 0 , 160 , 255 } , - {"IndianRed1Bis" , 204 , 255 , 95 , 135 , 246 , 160 , 255 } , - {"HotPink" , 205 , 255 , 95 , 175 , 235 , 160 , 255 } , - {"HotPinkBis" , 206 , 255 , 95 , 215 , 224 , 160 , 255 } , - {"MediumOrchid1Bis" , 207 , 255 , 95 , 255 , 213 , 160 , 255 } , - {"DarkOrange" , 208 , 255 , 135 , 0 , 22 , 255 , 255 } , - {"Salmon1" , 209 , 255 , 135 , 95 , 10 , 160 , 255 } , - {"LightCoral" , 210 , 255 , 135 , 135 , 0 , 120 , 255 } , - {"PaleVioletRed1" , 211 , 255 , 135 , 175 , 242 , 120 , 255 } , - {"Orchid2" , 212 , 255 , 135 , 215 , 228 , 120 , 255 } , - {"Orchid1" , 213 , 255 , 135 , 255 , 213 , 120 , 255 } , - {"Orange1" , 214 , 255 , 175 , 0 , 29 , 255 , 255 } , - {"SandyBrown" , 215 , 255 , 175 , 95 , 21 , 160 , 255 } , - {"LightSalmon1" , 216 , 255 , 175 , 135 , 14 , 120 , 255 } , - {"LightPink1" , 217 , 255 , 175 , 175 , 0 , 80 , 255 } , - {"Pink1" , 218 , 255 , 175 , 215 , 235 , 80 , 255 } , - {"Plum1" , 219 , 255 , 175 , 255 , 213 , 80 , 255 } , - {"Gold1" , 220 , 255 , 215 , 0 , 36 , 255 , 255 } , - {"LightGoldenrod2Bis" , 221 , 255 , 215 , 95 , 32 , 160 , 255 } , - {"LightGoldenrod2Ter" , 222 , 255 , 215 , 135 , 28 , 120 , 255 } , - {"NavajoWhite1" , 223 , 255 , 215 , 175 , 21 , 80 , 255 } , - {"MistyRose1" , 224 , 255 , 215 , 215 , 0 , 40 , 255 } , - {"Thistle1" , 225 , 255 , 215 , 255 , 213 , 40 , 255 } , - {"Yellow1" , 226 , 255 , 255 , 0 , 43 , 255 , 255 } , - {"LightGoldenrod1" , 227 , 255 , 255 , 95 , 43 , 160 , 255 } , - {"Khaki1" , 228 , 255 , 255 , 135 , 43 , 120 , 255 } , - {"Wheat1" , 229 , 255 , 255 , 175 , 43 , 80 , 255 } , - {"Cornsilk1" , 230 , 255 , 255 , 215 , 43 , 40 , 255 } , - {"Grey100" , 231 , 255 , 255 , 255 , 0 , 0 , 255 } , - {"Grey3" , 232 , 8 , 8 , 8 , 0 , 0 , 8 } , - {"Grey7" , 233 , 18 , 18 , 18 , 0 , 0 , 18 } , - {"Grey11" , 234 , 28 , 28 , 28 , 0 , 0 , 28 } , - {"Grey15" , 235 , 38 , 38 , 38 , 0 , 0 , 38 } , - {"Grey19" , 236 , 48 , 48 , 48 , 0 , 0 , 48 } , - {"Grey23" , 237 , 58 , 58 , 58 , 0 , 0 , 58 } , - {"Grey27" , 238 , 68 , 68 , 68 , 0 , 0 , 68 } , - {"Grey30" , 239 , 78 , 78 , 78 , 0 , 0 , 78 } , - {"Grey35" , 240 , 88 , 88 , 88 , 0 , 0 , 88 } , - {"Grey39" , 241 , 98 , 98 , 98 , 0 , 0 , 98 } , - {"Grey42" , 242 , 108 , 108 , 108 , 0 , 0 , 108 } , - {"Grey46" , 243 , 118 , 118 , 118 , 0 , 0 , 118 } , - {"Grey50" , 244 , 128 , 128 , 128 , 0 , 0 , 128 } , - {"Grey54" , 245 , 138 , 138 , 138 , 0 , 0 , 138 } , - {"Grey58" , 246 , 148 , 148 , 148 , 0 , 0 , 148 } , - {"Grey62" , 247 , 158 , 158 , 158 , 0 , 0 , 158 } , - {"Grey66" , 248 , 168 , 168 , 168 , 0 , 0 , 168 } , - {"Grey70" , 249 , 178 , 178 , 178 , 0 , 0 , 178 } , - {"Grey74" , 250 , 188 , 188 , 188 , 0 , 0 , 188 } , - {"Grey78" , 251 , 198 , 198 , 198 , 0 , 0 , 198 } , - {"Grey82" , 252 , 208 , 208 , 208 , 0 , 0 , 208 } , - {"Grey85" , 253 , 218 , 218 , 218 , 0 , 0 , 218 } , - {"Grey89" , 254 , 228 , 228 , 228 , 0 , 0 , 228 } , - {"Grey93" , 255 , 238 , 238 , 238 , 0 , 0 , 238 } , - } ; + {"Black" , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , + {"Red" , 1 , 1 , 128 , 0 , 0 , 0 , 255 , 128 } , + {"Green" , 2 , 2 , 0 , 128 , 0 , 85 , 255 , 128 } , + {"Yellow" , 3 , 3 , 128 , 128 , 0 , 43 , 255 , 128 } , + {"Blue" , 4 , 4 , 0 , 0 , 128 , 171 , 255 , 128 } , + {"Magenta" , 5 , 5 , 128 , 0 , 128 , 213 , 255 , 128 } , + {"Cyan" , 6 , 6 , 0 , 128 , 128 , 128 , 255 , 128 } , + {"GrayLight" , 7 , 7 , 192 , 192 , 192 , 0 , 0 , 192 } , + {"GrayDark" , 8 , 8 , 128 , 128 , 128 , 0 , 0 , 128 } , + {"RedLight" , 9 , 9 , 255 , 0 , 0 , 0 , 255 , 255 } , + {"GreenLight" , 10 , 10 , 0 , 255 , 0 , 85 , 255 , 255 } , + {"YellowLight" , 11 , 11 , 255 , 255 , 0 , 43 , 255 , 255 } , + {"BlueLight" , 12 , 12 , 0 , 0 , 255 , 171 , 255 , 255 } , + {"MagentaLight" , 13 , 13 , 255 , 0 , 255 , 213 , 255 , 255 } , + {"CyanLight" , 14 , 14 , 0 , 255 , 255 , 128 , 255 , 255 } , + {"White" , 15 , 15 , 255 , 255 , 255 , 0 , 0 , 255 } , + {"Grey0" , 16 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , + {"NavyBlue" , 17 , 4 , 0 , 0 , 95 , 171 , 255 , 95 } , + {"DarkBlue" , 18 , 4 , 0 , 0 , 135 , 171 , 255 , 135 } , + {"Blue3" , 19 , 4 , 0 , 0 , 175 , 171 , 255 , 175 } , + {"Blue3Bis" , 20 , 12 , 0 , 0 , 215 , 171 , 255 , 215 } , + {"Blue1" , 21 , 12 , 0 , 0 , 255 , 171 , 255 , 255 } , + {"DarkGreen" , 22 , 2 , 0 , 95 , 0 , 85 , 255 , 95 } , + {"DeepSkyBlue4" , 23 , 6 , 0 , 95 , 95 , 128 , 255 , 95 } , + {"DeepSkyBlue4Bis" , 24 , 6 , 0 , 95 , 135 , 141 , 255 , 135 } , + {"DeepSkyBlue4Ter" , 25 , 6 , 0 , 95 , 175 , 148 , 255 , 175 } , + {"DodgerBlue3" , 26 , 12 , 0 , 95 , 215 , 152 , 255 , 215 } , + {"DodgerBlue2" , 27 , 12 , 0 , 95 , 255 , 155 , 255 , 255 } , + {"Green4" , 28 , 2 , 0 , 135 , 0 , 85 , 255 , 135 } , + {"SpringGreen4" , 29 , 6 , 0 , 135 , 95 , 115 , 255 , 135 } , + {"Turquoise4" , 30 , 6 , 0 , 135 , 135 , 128 , 255 , 135 } , + {"DeepSkyBlue3" , 31 , 6 , 0 , 135 , 175 , 138 , 255 , 175 } , + {"DeepSkyBlue3Bis" , 32 , 14 , 0 , 135 , 215 , 144 , 255 , 215 } , + {"DodgerBlue1" , 33 , 14 , 0 , 135 , 255 , 149 , 255 , 255 } , + {"Green3" , 34 , 2 , 0 , 175 , 0 , 85 , 255 , 175 } , + {"SpringGreen3" , 35 , 6 , 0 , 175 , 95 , 108 , 255 , 175 } , + {"DarkCyan" , 36 , 6 , 0 , 175 , 135 , 118 , 255 , 175 } , + {"LightSeaGreen" , 37 , 6 , 0 , 175 , 175 , 128 , 255 , 175 } , + {"DeepSkyBlue2" , 38 , 14 , 0 , 175 , 215 , 136 , 255 , 215 } , + {"DeepSkyBlue1" , 39 , 14 , 0 , 175 , 255 , 142 , 255 , 255 } , + {"Green3Bis" , 40 , 10 , 0 , 215 , 0 , 85 , 255 , 215 } , + {"SpringGreen3Bis" , 41 , 10 , 0 , 215 , 95 , 104 , 255 , 215 } , + {"SpringGreen2" , 42 , 14 , 0 , 215 , 135 , 112 , 255 , 215 } , + {"Cyan3" , 43 , 14 , 0 , 215 , 175 , 120 , 255 , 215 } , + {"DarkTurquoise" , 44 , 14 , 0 , 215 , 215 , 128 , 255 , 215 } , + {"Turquoise2" , 45 , 14 , 0 , 215 , 255 , 135 , 255 , 255 } , + {"Green1" , 46 , 10 , 0 , 255 , 0 , 85 , 255 , 255 } , + {"SpringGreen2Bis" , 47 , 10 , 0 , 255 , 95 , 101 , 255 , 255 } , + {"SpringGreen1" , 48 , 14 , 0 , 255 , 135 , 107 , 255 , 255 } , + {"MediumSpringGreen" , 49 , 14 , 0 , 255 , 175 , 114 , 255 , 255 } , + {"Cyan2" , 50 , 14 , 0 , 255 , 215 , 121 , 255 , 255 } , + {"Cyan1" , 51 , 14 , 0 , 255 , 255 , 128 , 255 , 255 } , + {"DarkRed" , 52 , 1 , 95 , 0 , 0 , 0 , 255 , 95 } , + {"DeepPink4Ter" , 53 , 5 , 95 , 0 , 95 , 213 , 255 , 95 } , + {"Purple4" , 54 , 5 , 95 , 0 , 135 , 201 , 255 , 135 } , + {"Purple4Bis" , 55 , 5 , 95 , 0 , 175 , 194 , 255 , 175 } , + {"Purple3" , 56 , 12 , 95 , 0 , 215 , 190 , 255 , 215 } , + {"BlueViolet" , 57 , 12 , 95 , 0 , 255 , 187 , 255 , 255 } , + {"Orange4" , 58 , 3 , 95 , 95 , 0 , 43 , 255 , 95 } , + {"Grey37" , 59 , 8 , 95 , 95 , 95 , 0 , 0 , 95 } , + {"MediumPurple4" , 60 , 4 , 95 , 95 , 135 , 171 , 75 , 135 } , + {"SlateBlue3" , 61 , 4 , 95 , 95 , 175 , 171 , 116 , 175 } , + {"SlateBlue3Bis" , 62 , 12 , 95 , 95 , 215 , 171 , 142 , 215 } , + {"RoyalBlue1" , 63 , 12 , 95 , 95 , 255 , 171 , 160 , 255 } , + {"Chartreuse4" , 64 , 3 , 95 , 135 , 0 , 55 , 255 , 135 } , + {"DarkSeaGreen4" , 65 , 8 , 95 , 135 , 95 , 85 , 75 , 135 } , + {"PaleTurquoise4" , 66 , 6 , 95 , 135 , 135 , 128 , 75 , 135 } , + {"SteelBlue" , 67 , 4 , 95 , 135 , 175 , 150 , 116 , 175 } , + {"SteelBlue3" , 68 , 12 , 95 , 135 , 215 , 157 , 142 , 215 } , + {"CornflowerBlue" , 69 , 12 , 95 , 135 , 255 , 161 , 160 , 255 } , + {"Chartreuse3" , 70 , 3 , 95 , 175 , 0 , 62 , 255 , 175 } , + {"DarkSeaGreen4Bis" , 71 , 2 , 95 , 175 , 95 , 85 , 116 , 175 } , + {"CadetBlue" , 72 , 2 , 95 , 175 , 135 , 106 , 116 , 175 } , + {"CadetBlueBis" , 73 , 6 , 95 , 175 , 175 , 128 , 116 , 175 } , + {"SkyBlue3" , 74 , 14 , 95 , 175 , 215 , 143 , 142 , 215 } , + {"SteelBlue1" , 75 , 12 , 95 , 175 , 255 , 150 , 160 , 255 } , + {"Chartreuse3Bis" , 76 , 10 , 95 , 215 , 0 , 66 , 255 , 215 } , + {"PaleGreen3Bis" , 77 , 10 , 95 , 215 , 95 , 85 , 142 , 215 } , + {"SeaGreen3" , 78 , 10 , 95 , 215 , 135 , 99 , 142 , 215 } , + {"Aquamarine3" , 79 , 14 , 95 , 215 , 175 , 113 , 142 , 215 } , + {"MediumTurquoise" , 80 , 14 , 95 , 215 , 215 , 128 , 142 , 215 } , + {"SteelBlue1Bis" , 81 , 14 , 95 , 215 , 255 , 139 , 160 , 255 } , + {"Chartreuse2Bis" , 82 , 10 , 95 , 255 , 0 , 69 , 255 , 255 } , + {"SeaGreen2" , 83 , 10 , 95 , 255 , 95 , 85 , 160 , 255 } , + {"SeaGreen1" , 84 , 10 , 95 , 255 , 135 , 95 , 160 , 255 } , + {"SeaGreen1Bis" , 85 , 10 , 95 , 255 , 175 , 106 , 160 , 255 } , + {"Aquamarine1Bis" , 86 , 14 , 95 , 255 , 215 , 117 , 160 , 255 } , + {"DarkSlateGray2" , 87 , 14 , 95 , 255 , 255 , 128 , 160 , 255 } , + {"DarkRedBis" , 88 , 1 , 135 , 0 , 0 , 0 , 255 , 135 } , + {"DeepPink4Bis" , 89 , 5 , 135 , 0 , 95 , 226 , 255 , 135 } , + {"DarkMagenta" , 90 , 5 , 135 , 0 , 135 , 213 , 255 , 135 } , + {"DarkMagentaBis" , 91 , 5 , 135 , 0 , 175 , 204 , 255 , 175 } , + {"DarkVioletBis" , 92 , 13 , 135 , 0 , 215 , 198 , 255 , 215 } , + {"PurpleBis" , 93 , 13 , 135 , 0 , 255 , 193 , 255 , 255 } , + {"Orange4Bis" , 94 , 3 , 135 , 95 , 0 , 30 , 255 , 135 } , + {"LightPink4" , 95 , 8 , 135 , 95 , 95 , 0 , 75 , 135 } , + {"Plum4" , 96 , 5 , 135 , 95 , 135 , 213 , 75 , 135 } , + {"MediumPurple3" , 97 , 4 , 135 , 95 , 175 , 192 , 116 , 175 } , + {"MediumPurple3Bis" , 98 , 12 , 135 , 95 , 215 , 185 , 142 , 215 } , + {"SlateBlue1" , 99 , 12 , 135 , 95 , 255 , 181 , 160 , 255 } , + {"Yellow4" , 100 , 3 , 135 , 135 , 0 , 43 , 255 , 135 } , + {"Wheat4" , 101 , 8 , 135 , 135 , 95 , 43 , 75 , 135 } , + {"Grey53" , 102 , 8 , 135 , 135 , 135 , 0 , 0 , 135 } , + {"LightSlateGrey" , 103 , 4 , 135 , 135 , 175 , 171 , 58 , 175 } , + {"MediumPurple" , 104 , 12 , 135 , 135 , 215 , 171 , 94 , 215 } , + {"LightSlateBlue" , 105 , 12 , 135 , 135 , 255 , 171 , 120 , 255 } , + {"Yellow4Bis" , 106 , 3 , 135 , 175 , 0 , 52 , 255 , 175 } , + {"DarkOliveGreen3" , 107 , 7 , 135 , 175 , 95 , 64 , 116 , 175 } , + {"DarkSeaGreen" , 108 , 7 , 135 , 175 , 135 , 85 , 58 , 175 } , + {"LightSkyBlue3" , 109 , 7 , 135 , 175 , 175 , 128 , 58 , 175 } , + {"LightSkyBlue3Bis" , 110 , 12 , 135 , 175 , 215 , 150 , 94 , 215 } , + {"SkyBlue2" , 111 , 12 , 135 , 175 , 255 , 157 , 120 , 255 } , + {"Chartreuse2" , 112 , 11 , 135 , 215 , 0 , 58 , 255 , 215 } , + {"DarkOliveGreen3Bis" , 113 , 10 , 135 , 215 , 95 , 71 , 142 , 215 } , + {"PaleGreen3" , 114 , 7 , 135 , 215 , 135 , 85 , 94 , 215 } , + {"DarkSeaGreen3" , 115 , 10 , 135 , 215 , 175 , 106 , 94 , 215 } , + {"DarkSlateGray3" , 116 , 14 , 135 , 215 , 215 , 128 , 94 , 215 } , + {"SkyBlue1" , 117 , 14 , 135 , 215 , 255 , 143 , 120 , 255 } , + {"Chartreuse1" , 118 , 11 , 135 , 255 , 0 , 63 , 255 , 255 } , + {"LightGreen" , 119 , 10 , 135 , 255 , 95 , 75 , 160 , 255 } , + {"LightGreenBis" , 120 , 10 , 135 , 255 , 135 , 85 , 120 , 255 } , + {"PaleGreen1" , 121 , 10 , 135 , 255 , 175 , 99 , 120 , 255 } , + {"Aquamarine1" , 122 , 14 , 135 , 255 , 215 , 113 , 120 , 255 } , + {"DarkSlateGray1" , 123 , 14 , 135 , 255 , 255 , 128 , 120 , 255 } , + {"Red3" , 124 , 1 , 175 , 0 , 0 , 0 , 255 , 175 } , + {"DeepPink4" , 125 , 5 , 175 , 0 , 95 , 233 , 255 , 175 } , + {"MediumVioletRed" , 126 , 5 , 175 , 0 , 135 , 223 , 255 , 175 } , + {"Magenta3" , 127 , 5 , 175 , 0 , 175 , 213 , 255 , 175 } , + {"DarkViolet" , 128 , 13 , 175 , 0 , 215 , 206 , 255 , 215 } , + {"Purple" , 129 , 13 , 175 , 0 , 255 , 200 , 255 , 255 } , + {"DarkOrange3" , 130 , 3 , 175 , 95 , 0 , 23 , 255 , 175 } , + {"IndianRed" , 131 , 7 , 175 , 95 , 95 , 0 , 116 , 175 } , + {"HotPink3" , 132 , 5 , 175 , 95 , 135 , 235 , 116 , 175 } , + {"MediumOrchid3" , 133 , 5 , 175 , 95 , 175 , 213 , 116 , 175 } , + {"MediumOrchid" , 134 , 13 , 175 , 95 , 215 , 199 , 142 , 215 } , + {"MediumPurple2" , 135 , 12 , 175 , 95 , 255 , 192 , 160 , 255 } , + {"DarkGoldenrod" , 136 , 3 , 175 , 135 , 0 , 33 , 255 , 175 } , + {"LightSalmon3" , 137 , 7 , 175 , 135 , 95 , 21 , 116 , 175 } , + {"RosyBrown" , 138 , 7 , 175 , 135 , 135 , 0 , 58 , 175 } , + {"Grey63" , 139 , 5 , 175 , 135 , 175 , 213 , 58 , 175 } , + {"MediumPurple2Bis" , 140 , 12 , 175 , 135 , 215 , 192 , 94 , 215 } , + {"MediumPurple1" , 141 , 12 , 175 , 135 , 255 , 185 , 120 , 255 } , + {"Gold3" , 142 , 3 , 175 , 175 , 0 , 43 , 255 , 175 } , + {"DarkKhaki" , 143 , 7 , 175 , 175 , 95 , 43 , 116 , 175 } , + {"NavajoWhite3" , 144 , 7 , 175 , 175 , 135 , 43 , 58 , 175 } , + {"Grey69" , 145 , 7 , 175 , 175 , 175 , 0 , 0 , 175 } , + {"LightSteelBlue3" , 146 , 12 , 175 , 175 , 215 , 171 , 47 , 215 } , + {"LightSteelBlue" , 147 , 12 , 175 , 175 , 255 , 171 , 80 , 255 } , + {"Yellow3" , 148 , 11 , 175 , 215 , 0 , 50 , 255 , 215 } , + {"DarkOliveGreen3Ter" , 149 , 11 , 175 , 215 , 95 , 57 , 142 , 215 } , + {"DarkSeaGreen3Bis" , 150 , 7 , 175 , 215 , 135 , 64 , 94 , 215 } , + {"DarkSeaGreen2" , 151 , 7 , 175 , 215 , 175 , 85 , 47 , 215 } , + {"LightCyan3" , 152 , 7 , 175 , 215 , 215 , 128 , 47 , 215 } , + {"LightSkyBlue1" , 153 , 12 , 175 , 215 , 255 , 150 , 80 , 255 } , + {"GreenYellow" , 154 , 11 , 175 , 255 , 0 , 56 , 255 , 255 } , + {"DarkOliveGreen2" , 155 , 10 , 175 , 255 , 95 , 64 , 160 , 255 } , + {"PaleGreen1Bis" , 156 , 10 , 175 , 255 , 135 , 71 , 120 , 255 } , + {"DarkSeaGreen2Bis" , 157 , 15 , 175 , 255 , 175 , 85 , 80 , 255 } , + {"DarkSeaGreen1" , 158 , 15 , 175 , 255 , 215 , 106 , 80 , 255 } , + {"PaleTurquoise1" , 159 , 14 , 175 , 255 , 255 , 128 , 80 , 255 } , + {"Red3Bis" , 160 , 9 , 215 , 0 , 0 , 0 , 255 , 215 } , + {"DeepPink3" , 161 , 13 , 215 , 0 , 95 , 237 , 255 , 215 } , + {"DeepPink3Bis" , 162 , 13 , 215 , 0 , 135 , 229 , 255 , 215 } , + {"Magenta3Bis" , 163 , 13 , 215 , 0 , 175 , 221 , 255 , 215 } , + {"Magenta3Ter" , 164 , 13 , 215 , 0 , 215 , 213 , 255 , 215 } , + {"Magenta2" , 165 , 13 , 215 , 0 , 255 , 207 , 255 , 255 } , + {"DarkOrange3Bis" , 166 , 9 , 215 , 95 , 0 , 19 , 255 , 215 } , + {"IndianRedBis" , 167 , 9 , 215 , 95 , 95 , 0 , 142 , 215 } , + {"HotPink3Bis" , 168 , 13 , 215 , 95 , 135 , 242 , 142 , 215 } , + {"HotPink2" , 169 , 13 , 215 , 95 , 175 , 228 , 142 , 215 } , + {"Orchid" , 170 , 13 , 215 , 95 , 215 , 213 , 142 , 215 } , + {"MediumOrchid1" , 171 , 13 , 215 , 95 , 255 , 203 , 160 , 255 } , + {"Orange3" , 172 , 11 , 215 , 135 , 0 , 27 , 255 , 215 } , + {"LightSalmon3" , 173 , 9 , 215 , 135 , 95 , 14 , 142 , 215 } , + {"LightPink3" , 174 , 7 , 215 , 135 , 135 , 0 , 94 , 215 } , + {"Pink3" , 175 , 13 , 215 , 135 , 175 , 235 , 94 , 215 } , + {"Plum3" , 176 , 13 , 215 , 135 , 215 , 213 , 94 , 215 } , + {"Violet" , 177 , 13 , 215 , 135 , 255 , 199 , 120 , 255 } , + {"Gold3Bis" , 178 , 11 , 215 , 175 , 0 , 35 , 255 , 215 } , + {"LightGoldenrod3" , 179 , 11 , 215 , 175 , 95 , 28 , 142 , 215 } , + {"Tan" , 180 , 7 , 215 , 175 , 135 , 21 , 94 , 215 } , + {"MistyRose3" , 181 , 7 , 215 , 175 , 175 , 0 , 47 , 215 } , + {"Thistle3" , 182 , 13 , 215 , 175 , 215 , 213 , 47 , 215 } , + {"Plum2" , 183 , 12 , 215 , 175 , 255 , 192 , 80 , 255 } , + {"Yellow3Bis" , 184 , 11 , 215 , 215 , 0 , 43 , 255 , 215 } , + {"Khaki3" , 185 , 11 , 215 , 215 , 95 , 43 , 142 , 215 } , + {"LightGoldenrod2" , 186 , 7 , 215 , 215 , 135 , 43 , 94 , 215 } , + {"LightYellow3" , 187 , 7 , 215 , 215 , 175 , 43 , 47 , 215 } , + {"Grey84" , 188 , 7 , 215 , 215 , 215 , 0 , 0 , 215 } , + {"LightSteelBlue1" , 189 , 12 , 215 , 215 , 255 , 171 , 40 , 255 } , + {"Yellow2" , 190 , 11 , 215 , 255 , 0 , 49 , 255 , 255 } , + {"DarkOliveGreen1" , 191 , 11 , 215 , 255 , 95 , 53 , 160 , 255 } , + {"DarkOliveGreen1Bis" , 192 , 11 , 215 , 255 , 135 , 57 , 120 , 255 } , + {"DarkSeaGreen1Bis" , 193 , 15 , 215 , 255 , 175 , 64 , 80 , 255 } , + {"Honeydew2" , 194 , 15 , 215 , 255 , 215 , 85 , 40 , 255 } , + {"LightCyan1Bis" , 195 , 15 , 215 , 255 , 255 , 128 , 40 , 255 } , + {"Red1" , 196 , 9 , 255 , 0 , 0 , 0 , 255 , 255 } , + {"DeepPink2" , 197 , 13 , 255 , 0 , 95 , 240 , 255 , 255 } , + {"DeepPink1" , 198 , 13 , 255 , 0 , 135 , 234 , 255 , 255 } , + {"DeepPink1Bis" , 199 , 13 , 255 , 0 , 175 , 227 , 255 , 255 } , + {"Magenta2Bis" , 200 , 13 , 255 , 0 , 215 , 220 , 255 , 255 } , + {"Magenta1" , 201 , 13 , 255 , 0 , 255 , 213 , 255 , 255 } , + {"OrangeRed1" , 202 , 9 , 255 , 95 , 0 , 16 , 255 , 255 } , + {"IndianRed1" , 203 , 9 , 255 , 95 , 95 , 0 , 160 , 255 } , + {"IndianRed1Bis" , 204 , 13 , 255 , 95 , 135 , 246 , 160 , 255 } , + {"HotPink" , 205 , 13 , 255 , 95 , 175 , 235 , 160 , 255 } , + {"HotPinkBis" , 206 , 13 , 255 , 95 , 215 , 224 , 160 , 255 } , + {"MediumOrchid1Bis" , 207 , 13 , 255 , 95 , 255 , 213 , 160 , 255 } , + {"DarkOrange" , 208 , 11 , 255 , 135 , 0 , 22 , 255 , 255 } , + {"Salmon1" , 209 , 9 , 255 , 135 , 95 , 10 , 160 , 255 } , + {"LightCoral" , 210 , 15 , 255 , 135 , 135 , 0 , 120 , 255 } , + {"PaleVioletRed1" , 211 , 13 , 255 , 135 , 175 , 242 , 120 , 255 } , + {"Orchid2" , 212 , 13 , 255 , 135 , 215 , 228 , 120 , 255 } , + {"Orchid1" , 213 , 13 , 255 , 135 , 255 , 213 , 120 , 255 } , + {"Orange1" , 214 , 11 , 255 , 175 , 0 , 29 , 255 , 255 } , + {"SandyBrown" , 215 , 9 , 255 , 175 , 95 , 21 , 160 , 255 } , + {"LightSalmon1" , 216 , 15 , 255 , 175 , 135 , 14 , 120 , 255 } , + {"LightPink1" , 217 , 15 , 255 , 175 , 175 , 0 , 80 , 255 } , + {"Pink1" , 218 , 13 , 255 , 175 , 215 , 235 , 80 , 255 } , + {"Plum1" , 219 , 13 , 255 , 175 , 255 , 213 , 80 , 255 } , + {"Gold1" , 220 , 11 , 255 , 215 , 0 , 36 , 255 , 255 } , + {"LightGoldenrod2Bis" , 221 , 11 , 255 , 215 , 95 , 32 , 160 , 255 } , + {"LightGoldenrod2Ter" , 222 , 15 , 255 , 215 , 135 , 28 , 120 , 255 } , + {"NavajoWhite1" , 223 , 15 , 255 , 215 , 175 , 21 , 80 , 255 } , + {"MistyRose1" , 224 , 15 , 255 , 215 , 215 , 0 , 40 , 255 } , + {"Thistle1" , 225 , 13 , 255 , 215 , 255 , 213 , 40 , 255 } , + {"Yellow1" , 226 , 11 , 255 , 255 , 0 , 43 , 255 , 255 } , + {"LightGoldenrod1" , 227 , 11 , 255 , 255 , 95 , 43 , 160 , 255 } , + {"Khaki1" , 228 , 15 , 255 , 255 , 135 , 43 , 120 , 255 } , + {"Wheat1" , 229 , 15 , 255 , 255 , 175 , 43 , 80 , 255 } , + {"Cornsilk1" , 230 , 15 , 255 , 255 , 215 , 43 , 40 , 255 } , + {"Grey100" , 231 , 15 , 255 , 255 , 255 , 0 , 0 , 255 } , + {"Grey3" , 232 , 0 , 8 , 8 , 8 , 0 , 0 , 8 } , + {"Grey7" , 233 , 0 , 18 , 18 , 18 , 0 , 0 , 18 } , + {"Grey11" , 234 , 0 , 28 , 28 , 28 , 0 , 0 , 28 } , + {"Grey15" , 235 , 0 , 38 , 38 , 38 , 0 , 0 , 38 } , + {"Grey19" , 236 , 0 , 48 , 48 , 48 , 0 , 0 , 48 } , + {"Grey23" , 237 , 0 , 58 , 58 , 58 , 0 , 0 , 58 } , + {"Grey27" , 238 , 8 , 68 , 68 , 68 , 0 , 0 , 68 } , + {"Grey30" , 239 , 8 , 78 , 78 , 78 , 0 , 0 , 78 } , + {"Grey35" , 240 , 8 , 88 , 88 , 88 , 0 , 0 , 88 } , + {"Grey39" , 241 , 8 , 98 , 98 , 98 , 0 , 0 , 98 } , + {"Grey42" , 242 , 8 , 108 , 108 , 108 , 0 , 0 , 108 } , + {"Grey46" , 243 , 8 , 118 , 118 , 118 , 0 , 0 , 118 } , + {"Grey50" , 244 , 8 , 128 , 128 , 128 , 0 , 0 , 128 } , + {"Grey54" , 245 , 8 , 138 , 138 , 138 , 0 , 0 , 138 } , + {"Grey58" , 246 , 8 , 148 , 148 , 148 , 0 , 0 , 148 } , + {"Grey62" , 247 , 8 , 158 , 158 , 158 , 0 , 0 , 158 } , + {"Grey66" , 248 , 7 , 168 , 168 , 168 , 0 , 0 , 168 } , + {"Grey70" , 249 , 7 , 178 , 178 , 178 , 0 , 0 , 178 } , + {"Grey74" , 250 , 7 , 188 , 188 , 188 , 0 , 0 , 188 } , + {"Grey78" , 251 , 7 , 198 , 198 , 198 , 0 , 0 , 198 } , + {"Grey82" , 252 , 7 , 208 , 208 , 208 , 0 , 0 , 208 } , + {"Grey85" , 253 , 7 , 218 , 218 , 218 , 0 , 0 , 218 } , + {"Grey89" , 254 , 15 , 228 , 228 , 228 , 0 , 0 , 228 } , + {"Grey93" , 255 , 15 , 238 , 238 , 238 , 0 , 0 , 238 } , +} ; ColorInfo GetColorInfo(Color::Palette256 index) { return palette256[int(index)]; } + +ColorInfo GetColorInfo(Color::Palette16 index) { + return palette256[int(index)]; +} // clang-format off } diff --git a/src/ftxui/screen/terminal.cpp b/src/ftxui/screen/terminal.cpp index 804de09..1ff573b 100644 --- a/src/ftxui/screen/terminal.cpp +++ b/src/ftxui/screen/terminal.cpp @@ -35,13 +35,34 @@ Terminal::Dimensions Terminal::Size() { #endif } -bool Terminal::CanSupportTrueColors() { - char *COLORTERM_RAW = std::getenv("COLORTERM"); - if (nullptr == COLORTERM_RAW) { - return false; +namespace { + +const char* Safe(const char* c) { + return c ? c : ""; +} + +static bool cached = false; +Terminal::Color cached_supported_color; +Terminal::Color ComputeColorSupport() { + std::string COLORTERM = Safe(std::getenv("COLORTERM")); + if (COLORTERM.compare("24bit") || COLORTERM.compare("trueColor")) + return Terminal::Color::TrueColor; + + std::string TERM = Safe(std::getenv("TERM")); + if (COLORTERM.compare("256") || COLORTERM.compare("256")) + return Terminal::Color::Palette256; + + return Terminal::Color::Palette16; +} + +} // namespace + +Terminal::Color Terminal::ColorSupport() { + if (!cached) { + cached = true; + cached_supported_color = ComputeColorSupport(); } - std::string COLORTERM = COLORTERM_RAW; - return COLORTERM.compare("24bit") || COLORTERM.compare("trueColor"); + return cached_supported_color; } } // namespace ftxui