├── .gitignore ├── image ├── how.png ├── hue.png ├── why.png ├── hello.png ├── stock.png └── tech.png ├── _config.yml ├── examples ├── hello.cpp ├── hue.cpp ├── how.cpp ├── why.cpp └── mark.cpp ├── LICENSE ├── README.md └── include └── color.hpp /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | -------------------------------------------------------------------------------- /image/how.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aafulei/color-console/HEAD/image/how.png -------------------------------------------------------------------------------- /image/hue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aafulei/color-console/HEAD/image/hue.png -------------------------------------------------------------------------------- /image/why.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aafulei/color-console/HEAD/image/why.png -------------------------------------------------------------------------------- /image/hello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aafulei/color-console/HEAD/image/hello.png -------------------------------------------------------------------------------- /image/stock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aafulei/color-console/HEAD/image/stock.png -------------------------------------------------------------------------------- /image/tech.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aafulei/color-console/HEAD/image/tech.png -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | plugins: 3 | - jekyll-relative-links 4 | relative_links: 5 | enabled: true 6 | collections: true 7 | include: 8 | - README.md 9 | -------------------------------------------------------------------------------- /examples/hello.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/color.hpp" 2 | #include 3 | 4 | int main() 5 | { 6 | std::cout << dye::aqua("Hello, World!") << std::endl; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /examples/hue.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/color.hpp" 2 | #include 3 | 4 | int main() 5 | { 6 | std::cout << hue::light_red << hue::on_bright_white 7 | << "Hello, World" << hue::reset << std::endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Lei Fu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/how.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/color.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | struct DoubleVector : private vector 9 | { 10 | using vector::vector; 11 | friend ostream & operator<<(ostream &, const DoubleVector &); 12 | }; 13 | 14 | ostream & operator<<(ostream & os, const DoubleVector & v) 15 | { 16 | for (const auto & e : v) 17 | os << e << " "; 18 | return os; 19 | } 20 | 21 | int main() 22 | { 23 | auto a = dye::on_yellow(42); 24 | cout << a << endl; 25 | 26 | using vec = DoubleVector; 27 | 28 | auto b = dye::red(vec{1, 2, 3}); 29 | b = b + dye::blue(vec{4, 5, 6}); 30 | b += dye::green(vec{7, 8, 9}); 31 | cout << b << endl; 32 | 33 | cout << dye::on_white(string("strings")) + " are " + 34 | dye::on_white("more") + string(" flexible") << endl; 35 | 36 | cout << dye::colorize("grape", "purple") << endl; 37 | 38 | cout << dye::invert(dye::red("red")) << endl; 39 | 40 | auto contrast = dye::vanilla("contrast"); 41 | cout << contrast.invert() << endl; 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /examples/why.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/color.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | struct DoubleVector : private vector 9 | { 10 | using vector::vector; 11 | friend ostream & operator<<(ostream &, const DoubleVector &); 12 | }; 13 | 14 | ostream & operator<<(ostream & os, const DoubleVector & v) 15 | { 16 | for (const auto & e : v) 17 | os << e << " "; 18 | return os; 19 | } 20 | 21 | int main() 22 | { 23 | cout << "When in doubt, wear " << dye::red("red") << "." << endl; 24 | 25 | auto green = dye::green("green"); 26 | cout << "I saw "<< green << " trees, " << green << " bushes." << endl; 27 | 28 | cout << "Take the " << dye::blue("Blue") << " Line and then " 29 | << "catch Bus " << dye::yellow(42 + 7 % 8) << "."<< endl; 30 | 31 | cout << dye::purple(DoubleVector{3.14, 2.72}) << endl; 32 | 33 | cout << dye::light_red('A') + dye::light_blue('B') 34 | + dye::light_green('C') << endl; 35 | 36 | const char ca[] = "ca"; 37 | string str = "str"; 38 | cout << "[ " + dye::aqua(ca) + " | " + dye::aqua(str) + " ]" << endl; 39 | 40 | double a = 88.88; 41 | cout << dye::colorize(a, a >= 0 ? "red" : "green").invert() << endl; 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /examples/mark.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/color.hpp" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | const set TO_WATCH = {"google", "facebook", "microsoft", "twitter"}; 13 | 14 | void segment(const string & s, decltype(s.begin()) & a, decltype(s.end()) & b) 15 | { 16 | auto is_punct = [](char c) -> bool 17 | { 18 | auto punct = set{',', '.', ':', ';', '?', '!', 19 | '\'', '\"', '(', ')'}; 20 | return punct.find(c) != punct.end(); 21 | }; 22 | 23 | a = find_if_not(s.cbegin(), s.cend(), is_punct); 24 | b = find_if_not(s.crbegin(), s.crend(), is_punct).base(); 25 | // if entire s is punct, this punct is deemed a post punct 26 | if (a == s.cend()) 27 | a = s.cbegin(); 28 | } 29 | 30 | void separate(const string & s, string & pre, string & word, string & post) 31 | { 32 | auto a = s.cbegin(), b = s.cend(); 33 | segment(s, a, b); 34 | pre = string(s.cbegin(), a); 35 | word = string(a, b); 36 | post = string(b, s.cend()); 37 | } 38 | 39 | bool is_keyword(string s, const set & names = TO_WATCH) 40 | { 41 | transform(s.begin(), s.end(), s.begin(), ::tolower); 42 | return names.find(s) != names.end(); 43 | } 44 | 45 | bool is_number(string s) 46 | { 47 | if (s.empty()) 48 | return false; 49 | auto a = s.cbegin(), b = s.cend(); 50 | if (s.front() == '$') 51 | a = s.cbegin() + 1; 52 | if (s.back() == '%') 53 | b = s.cend() - 1; 54 | s = string(a, b); 55 | return !s.empty() && s.find_first_not_of(",.1234567890") == string::npos; 56 | } 57 | 58 | #if __cplusplus < 201402L 59 | auto mark(const string & str, string color) -> decltype(dye::vanilla("")) 60 | #else 61 | auto mark(const string & str, string color) 62 | #endif 63 | { 64 | istringstream iss(str); 65 | auto marked = dye::vanilla(""); 66 | for (string line; getline(iss, line); marked += "\n") { 67 | istringstream lineiss(line); 68 | for (string text; lineiss >> text; marked += " ") { 69 | string pre, word, post; 70 | // split a text into 3 parts: word in middle, and punctuations around it 71 | separate(text, pre, word, post); 72 | marked += pre; 73 | if (is_keyword(word)) 74 | marked += dye::colorize(word, color).invert(); 75 | else if (is_number(word)) 76 | marked += dye::colorize(word, color); 77 | else 78 | marked += word; 79 | marked += post; 80 | } 81 | } 82 | return marked; 83 | } 84 | 85 | int main() 86 | { 87 | auto tech_news = "Silicon Valley giants including Google, Facebook and " 88 | "Twitter are headed to Capitol Hill. Here's what you " 89 | "can expect from their hearings."; 90 | 91 | cout << mark(tech_news, "light_red") << endl; 92 | 93 | auto stock_news = "Shares in Twitter, Snap and Facebook all declined " 94 | "significantly, dragging the Nasdaq down more than 1% " 95 | "to below the 8,000 level.\n\nTwitter fell 6% to end the " 96 | "session at $32.17. \n\nFacebook saw its shares fall more " 97 | "than 2% to finish at $167.18.\n\nGoogle parent, " 98 | "Alphabet, came in for a drubbing during the hearing " 99 | "because it declined to accept the committes's " 100 | "invitation to testify. The company's stock slipped " 101 | "nearly 1% to close at 1186.48.\n\nMicrosoft fell almost " 102 | "3% on the day, to $108.49."; 103 | 104 | cout << mark(stock_news, "yellow") << endl; 105 | 106 | return 0; 107 | } 108 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Color Console 2 | 3 | A lightweight header-only C++ library to bring colors to your Windows console with a very-easy-to-use API that frees you from the burden of setting and resetting screen colors every time you make a call. 4 | 5 | 6 | 7 | ## Contents 8 | 9 | - [Installation](#instllation) 10 | - [Getting Started](#getting-started) 11 | - [Why Use It?](#why-use-it) 12 | - [A Real Example](#a-real-example) 13 | - [How to Use](#how-to-use) 14 | - [Color Tags](#color-tags) 15 | - [`dye` Namespace](#dye-namespace) 16 | - [`hue` Namespace](#hue-namespace) 17 | - [Technical Note](#technical-note) 18 | 19 | ## Installation 20 | 21 | Put [`color.hpp`](include/color.hpp) in the folder where you include headers. 22 | 23 | *For Windows. C++11 support required. C++14 or above recommended.* 24 | 25 | ## Getting Started 26 | 27 | ```c++ 28 | #include "../include/color.hpp" 29 | #include 30 | 31 | int main() 32 | { 33 | std::cout << dye::aqua("Hello, World!") << std::endl; 34 | return 0; 35 | } 36 | ``` 37 | 38 | You are seeing `Hello, World!` in aqua. 39 | 40 | 41 | 42 | *Try saying [Hello, World](examples/hello.cpp) yourself.* 43 | 44 | ## Why Use It? 45 | 46 | 47 | 48 | 1. **No need to reset :** most solutions on the market work like manipulators, which *constantly* require you to reset the screen color after you set it. While this traditional approach is also offered in this library in the `hue` namespace 49 | 50 | ```c++ 51 | cout << "When in doubt, wear " << hue::red << "red" << hue::reset << "." << endl; 52 | ``` 53 | 54 | it can be boring to do so. Why not just `dye` the object 55 | 56 | ```c++ 57 | cout << "When in doubt, wear " << dye::red("red") << "." << endl; 58 | ``` 59 | 60 | 2. **Object-oriented :** you may `dye` an object and save it for later (re)use 61 | 62 | ```c++ 63 | auto green = dye::green("green"); 64 | cout << "I saw "<< green << " trees, " << green << " bushes." << endl; 65 | ``` 66 | 67 | 3. **`dye` anything :** `int` `double` `char` `std::string` ... 68 | 69 | ```c++ 70 | cout << "Take the " << dye::blue("Blue") << " Line and then " 71 | << "catch Bus " << dye::yellow(42 + 7 % 8) << "."<< endl; 72 | ``` 73 | 74 | In fact, you can `dye` any object for which `operator<<` is properly defined. Suppose we have 75 | 76 | ```c++ 77 | struct DoubleVector; 78 | ostream & operator<<(ostream &, const DoubleVector &); 79 | ``` 80 | 81 | we are free to `dye` 82 | 83 | ```c++ 84 | cout << dye::purple(DoubleVector{3.14, 2.72}) << endl; 85 | ``` 86 | 87 | 88 | 4. **`+` dyed objects, even colors differ :** 89 | 90 | ```c++ 91 | cout << dye::light_red('A') + dye::light_blue('B') + dye::light_green('C') << endl; 92 | ``` 93 | 94 | 5. **Extra support for strings :** be it `std::string` or C-style strings, dyed or undyed, you can mix them up without caring about their types. 95 | 96 | ```c++ 97 | const char ca[] = "ca"; 98 | string str = "str"; 99 | cout << "[ " + dye::aqua(ca) + " | " + dye::aqua(str) + " ]" << endl; 100 | ``` 101 | 102 | 6. **Convenient and extensible API :** say `colorize` an object according to the parameter, or quickly `invert` the color 103 | 104 | ```c++ 105 | double a = 88.88; 106 | cout << dye::colorize(a, a >= 0 ? "red" : "green").invert() << endl; 107 | ``` 108 | 109 | *Try the [above cases](examples/why.cpp) yourself.* 110 | 111 | ## A Real Example 112 | 113 | With [Color Console](include/color.hpp), we implement an [auto marker](examples/mark.cpp) which highlights keywords given in a watch list and colorizes numbers as well. The key function is 114 | 115 | ```c++ 116 | using namespace std; 117 | 118 | auto mark(const string & str, string color) 119 | { 120 | istringstream iss(str); 121 | auto marked = dye::vanilla(""); 122 | for (string line; getline(iss, line); marked += "\n") { 123 | istringstream lineiss(line); 124 | for (string text; lineiss >> text; marked += " ") { 125 | string pre, word, post; 126 | // split a text into 3 parts: word in middle, and punctuations around it 127 | separate(text, pre, word, post); 128 | marked += pre; 129 | if (is_keyword(word)) 130 | marked += dye::colorize(word, color).invert(); 131 | else if (is_number(word)) 132 | marked += dye::colorize(word, color); 133 | else 134 | marked += word; 135 | marked += post; 136 | } 137 | } 138 | return marked; 139 | } 140 | ``` 141 | 142 | To mark the introductory paragraph of a tech news 143 | 144 | ```c++ 145 | cout << mark(tech_news, "light_red") << endl; 146 | ``` 147 | 148 | You will see 149 | 150 | 151 | 152 | As another example in which we mark both keywords and numbers 153 | 154 | ```c++ 155 | cout << mark(stock_news, "yellow") << endl; 156 | ``` 157 | 158 | We are having 159 | 160 | 161 | 162 | *For the details, see the [full implementation](examples/mark.cpp).* 163 | 164 | ## How to Use 165 | 166 | [Color Console](include/color.hpp) offers two sets of solutions which are put separately in two namespaces 167 | 168 | 1. objected-oriented `dye` ( :star:*highly recommended* ) 169 | 2. console-oriented, manipulator-like, traditional `hue` 170 | 171 | There are 16 single colors and thus 256 combinations (text + background) supported by Windows console. 172 | 173 | Know the color tags and `dye` your console (or change its `hue`) immediately! 174 | 175 | ### **Color Tags** 176 | 177 | - **Single / Text** 178 | - ***Basic*** `black` `blue` `green` `aqua` `red` `purple` `yellow` `white` `grey` 179 | - ***Light*** `light_blue` `light_green` `light_aqua` `light_red` `light_purple` `light_yellow` 180 | - ***Bright*** `bright_white` 181 | 182 | - **Background** 183 | - `on_[single]` *e.g.* `on_light_aqua` 184 | 185 | - **Compound** 186 | - `[single]_on_[single]` *e.g.* `light_red_on_bright_white` 187 | 188 | - **Special** 189 | - `vanilla` do nothing *i.e.* stay in current console color 190 | 191 | ### `dye` Namespace 192 | 193 | ***An object-oriented solution.*** 194 | 195 | 196 | 197 | - `dye::color_tag(object)` generates a dyed object ready for colorized output 198 | 199 | ```c++ 200 | auto a = dye::on_yellow(42); 201 | cout << a << endl; 202 | ``` 203 | 204 | - You may use `+` or `+=` to make a chain of dyed objects. Colors may differ, so long as the types of the original objects stay the same. 205 | 206 | ```c++ 207 | using vec = DoubleVector; 208 | 209 | auto b = dye::red(vec{1, 2, 3}); 210 | b = b + dye::blue(vec{4, 5, 6}); 211 | b += dye::green(vec{7, 8, 9}); 212 | cout << b << endl; 213 | ``` 214 | 215 | - Rules for strings are even more flexible. You may `+` or `+=` any compatible strings, even those undyed ones. 216 | 217 | ```c++ 218 | cout << dye::on_white(string("strings")) + " are " + 219 | dye::on_white("more") + string(" flexible") << endl; 220 | ``` 221 | 222 | - `dye::colorize(object, color_tag)` dyes `object` with `color_tag` 223 | 224 | ```c++ 225 | cout << dye::colorize("grape", "purple") << endl; 226 | ``` 227 | 228 | - `dye::invert(dyed)` generates a new object in inverted color. `dyed.invert()` does that in place. 229 | 230 | ```c++ 231 | cout << dye::invert(dye::red("red")) << endl; 232 | 233 | auto contrast = dye::vanilla("contrast"); 234 | cout << contrast.invert() << endl; 235 | ``` 236 | 237 | *Try the [above cases](examples/how.cpp) yourself.* 238 | 239 | ### `hue` Namespace 240 | 241 | ***A console-oriented, manipulator-like, traditional solution.*** 242 | 243 | - `cout << hue::color_tag` to set the text color to `color_tag` 244 | 245 | - `cout << hue::reset` to reset the console color (to white text and black background) 246 | 247 | ```c++ 248 | #include "../include/color.hpp" 249 | #include 250 | 251 | int main() 252 | { 253 | std::cout << hue::light_red << hue::on_bright_white 254 | << "Hello, World" << hue::reset << std::endl; 255 | return 0; 256 | } 257 | ``` 258 | 259 | 260 | 261 | *Try saying [Hello, World](examples/hue.cpp) in the traditional manner.* 262 | 263 | *Note: Do remember to `reset`, otherwise you're causing troubles to late-users of the console.* 264 | 265 | ## Technical Note 266 | 267 | - *move semantics* are widely used. Fast `+` operations are supported between dyed objects, especially for temporaries. Since more rvalues than lvalues are expected in use, we adopt a *pass-by-value-and-move* pattern. 268 | - `dye::red` and the like are in fact template factory functions that spit out dyed objects. Function template argument deduction is made use of to free users from having to specify the types explicitly (*e.g.* `dye::red("hello")`). 269 | - users shouldn't worry about the types of the dyed objects. If they want to, there are two layers of template classes: a `dye::item` to hold a single object, and a container `dye::colorful>` to hold `item`(s). `item` is intermediate and kept internally. Users are always using `colorful`, of one or many `item`(s). 270 | - a compile-time type-conversion technique (called `bar`) is employed so that even function template argument deduction concludes it sees a `const char *` the dyed object generated would be based on `std::string`. 271 | 272 | 273 | 274 | [Back to Top](#color-console) 275 | -------------------------------------------------------------------------------- /include/color.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COLOR_HPP 2 | #define COLOR_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace hue 14 | { 15 | constexpr int DEFAULT_COLOR = 7; 16 | constexpr int BAD_COLOR = -256; 17 | 18 | const std::map CODES = { 19 | {"black", 0}, {"k", 0}, 20 | {"blue", 1}, {"b", 1}, 21 | {"green", 2}, {"g", 2}, 22 | {"aqua", 3}, {"a", 3}, 23 | {"red", 4}, {"r", 4}, 24 | {"purple", 5}, {"p", 5}, 25 | {"yellow", 6}, {"y", 6}, 26 | {"white", 7}, {"w", 7}, 27 | {"grey", 8}, {"e", 8}, 28 | {"light blue", 9}, {"lb", 9}, 29 | {"light green", 10}, {"lg", 10}, 30 | {"light aqua", 11}, {"la", 11}, 31 | {"light red", 12}, {"lr", 12}, 32 | {"light purple", 13}, {"lp", 13}, 33 | {"light yellow", 14}, {"ly", 14}, 34 | {"bright white", 15}, {"bw", 15} 35 | }; 36 | 37 | const std::map NAMES = { 38 | { 0, "black"}, 39 | { 1, "blue"}, 40 | { 2, "green"}, 41 | { 3, "aqua"}, 42 | { 4, "red"}, 43 | { 5, "purple"}, 44 | { 6, "yellow"}, 45 | { 7, "white"}, 46 | { 8, "grey"}, 47 | { 9, "light blue"}, 48 | {10, "light green"}, 49 | {11, "light aqua"}, 50 | {12, "light red"}, 51 | {13, "light purple"}, 52 | {14, "light yellow"}, 53 | {15, "bright white"} 54 | }; 55 | 56 | inline bool is_good(int c) 57 | { 58 | return 0 <= c && c < 256; 59 | } 60 | 61 | inline int itoc(int c) 62 | { 63 | return is_good(c) ? c : BAD_COLOR; 64 | } 65 | 66 | inline int itoc(int a, int b) 67 | { 68 | return itoc(a + b * 16); 69 | } 70 | 71 | // std::string to color 72 | int stoc(std::string a) 73 | { 74 | // convert s to lowercase, and format variants like "light_blue" 75 | std::transform(a.begin(), a.end(), a.begin(), [](char c) 76 | { 77 | if ('A' <= c && c <= 'Z') 78 | c = c - 'A' + 'a'; 79 | else if (c == '_' || c == '-') 80 | c = ' '; 81 | return c; 82 | }); 83 | 84 | // operator[] on std::map is non-const, use std::map::at instead 85 | return (CODES.find(a) != CODES.end()) ? CODES.at(a) : BAD_COLOR; 86 | } 87 | 88 | int stoc(std::string a, std::string b) 89 | { 90 | return itoc(stoc(a), stoc(b)); 91 | } 92 | 93 | std::string ctos(int c) 94 | { 95 | return (0 <= c && c < 256) ? 96 | "(text) " + NAMES.at(c % 16) + " + " + 97 | "(background) " + NAMES.at(c / 16) : 98 | "BAD COLOR"; 99 | } 100 | 101 | int get() 102 | { 103 | CONSOLE_SCREEN_BUFFER_INFO i; 104 | return GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &i) ? 105 | i.wAttributes : BAD_COLOR; 106 | } 107 | 108 | int get_text() 109 | { 110 | return (get() != BAD_COLOR) ? get() % 16 : BAD_COLOR; 111 | } 112 | 113 | int get_background() 114 | { 115 | return (get() != BAD_COLOR) ? get() / 16 : BAD_COLOR; 116 | } 117 | 118 | void set(int c) 119 | { 120 | if (is_good(c)) 121 | SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), c); 122 | } 123 | 124 | void set(int a, int b) 125 | { 126 | set(a + b * 16); 127 | } 128 | 129 | void set(std::string a, std::string b) 130 | { 131 | set(stoc(a) + stoc(b) * 16); 132 | } 133 | 134 | void set_text(std::string a) 135 | { 136 | set(stoc(a), get_background()); 137 | } 138 | 139 | void set_background(std::string b) 140 | { 141 | set(get_text(), stoc(b)); 142 | } 143 | 144 | void reset() 145 | { 146 | set(DEFAULT_COLOR); 147 | } 148 | 149 | int invert(int c) 150 | { 151 | if (is_good(c)) { 152 | int a = c % 16; 153 | int b = c / 16; 154 | return b + a * 16; 155 | } 156 | else 157 | return BAD_COLOR; 158 | } 159 | 160 | std::ostream & reset(std::ostream & os) { reset(); return os; } 161 | std::ostream & black(std::ostream & os) { set_text("k"); return os; } 162 | std::ostream & blue(std::ostream & os) { set_text("b"); return os; } 163 | std::ostream & green(std::ostream & os) { set_text("g"); return os; } 164 | std::ostream & aqua(std::ostream & os) { set_text("a"); return os; } 165 | std::ostream & red(std::ostream & os) { set_text("r"); return os; } 166 | std::ostream & purple(std::ostream & os) { set_text("p"); return os; } 167 | std::ostream & yellow(std::ostream & os) { set_text("y"); return os; } 168 | std::ostream & white(std::ostream & os) { set_text("w"); return os; } 169 | std::ostream & grey(std::ostream & os) { set_text("e"); return os; } 170 | std::ostream & light_blue(std::ostream & os) { set_text("lb"); return os; } 171 | std::ostream & light_green(std::ostream & os) { set_text("lg"); return os; } 172 | std::ostream & light_aqua(std::ostream & os) { set_text("la"); return os; } 173 | std::ostream & light_red(std::ostream & os) { set_text("lr"); return os; } 174 | std::ostream & light_purple(std::ostream & os) { set_text("lp"); return os; } 175 | std::ostream & light_yellow(std::ostream & os) { set_text("ly"); return os; } 176 | std::ostream & bright_white(std::ostream & os) { set_text("bw"); return os; } 177 | std::ostream & on_black(std::ostream & os) { set_background("k"); return os; } 178 | std::ostream & on_blue(std::ostream & os) { set_background("b"); return os; } 179 | std::ostream & on_green(std::ostream & os) { set_background("g"); return os; } 180 | std::ostream & on_aqua(std::ostream & os) { set_background("a"); return os; } 181 | std::ostream & on_red(std::ostream & os) { set_background("r"); return os; } 182 | std::ostream & on_purple(std::ostream & os) { set_background("p"); return os; } 183 | std::ostream & on_yellow(std::ostream & os) { set_background("y"); return os; } 184 | std::ostream & on_white(std::ostream & os) { set_background("w"); return os; } 185 | std::ostream & on_grey(std::ostream & os) { set_background("e"); return os; } 186 | std::ostream & on_light_blue(std::ostream & os) { set_background("lb"); return os; } 187 | std::ostream & on_light_green(std::ostream & os) { set_background("lg"); return os; } 188 | std::ostream & on_light_aqua(std::ostream & os) { set_background("la"); return os; } 189 | std::ostream & on_light_red(std::ostream & os) { set_background("lr"); return os; } 190 | std::ostream & on_light_purple(std::ostream & os) { set_background("lp"); return os; } 191 | std::ostream & on_light_yellow(std::ostream & os) { set_background("ly"); return os; } 192 | std::ostream & on_bright_white(std::ostream & os) { set_background("bw"); return os; } 193 | std::ostream & black_on_black(std::ostream & os) { set("k", "k"); return os; } 194 | std::ostream & black_on_blue(std::ostream & os) { set("k", "b"); return os; } 195 | std::ostream & black_on_green(std::ostream & os) { set("k", "g"); return os; } 196 | std::ostream & black_on_aqua(std::ostream & os) { set("k", "a"); return os; } 197 | std::ostream & black_on_red(std::ostream & os) { set("k", "r"); return os; } 198 | std::ostream & black_on_purple(std::ostream & os) { set("k", "p"); return os; } 199 | std::ostream & black_on_yellow(std::ostream & os) { set("k", "y"); return os; } 200 | std::ostream & black_on_white(std::ostream & os) { set("k", "w"); return os; } 201 | std::ostream & black_on_grey(std::ostream & os) { set("k", "e"); return os; } 202 | std::ostream & black_on_light_blue(std::ostream & os) { set("k", "lb"); return os; } 203 | std::ostream & black_on_light_green(std::ostream & os) { set("k", "lg"); return os; } 204 | std::ostream & black_on_light_aqua(std::ostream & os) { set("k", "la"); return os; } 205 | std::ostream & black_on_light_red(std::ostream & os) { set("k", "lr"); return os; } 206 | std::ostream & black_on_light_purple(std::ostream & os) { set("k", "lp"); return os; } 207 | std::ostream & black_on_light_yellow(std::ostream & os) { set("k", "ly"); return os; } 208 | std::ostream & black_on_bright_white(std::ostream & os) { set("k", "bw"); return os; } 209 | std::ostream & blue_on_black(std::ostream & os) { set("b", "k"); return os; } 210 | std::ostream & blue_on_blue(std::ostream & os) { set("b", "b"); return os; } 211 | std::ostream & blue_on_green(std::ostream & os) { set("b", "g"); return os; } 212 | std::ostream & blue_on_aqua(std::ostream & os) { set("b", "a"); return os; } 213 | std::ostream & blue_on_red(std::ostream & os) { set("b", "r"); return os; } 214 | std::ostream & blue_on_purple(std::ostream & os) { set("b", "p"); return os; } 215 | std::ostream & blue_on_yellow(std::ostream & os) { set("b", "y"); return os; } 216 | std::ostream & blue_on_white(std::ostream & os) { set("b", "w"); return os; } 217 | std::ostream & blue_on_grey(std::ostream & os) { set("b", "e"); return os; } 218 | std::ostream & blue_on_light_blue(std::ostream & os) { set("b", "lb"); return os; } 219 | std::ostream & blue_on_light_green(std::ostream & os) { set("b", "lg"); return os; } 220 | std::ostream & blue_on_light_aqua(std::ostream & os) { set("b", "la"); return os; } 221 | std::ostream & blue_on_light_red(std::ostream & os) { set("b", "lr"); return os; } 222 | std::ostream & blue_on_light_purple(std::ostream & os) { set("b", "lp"); return os; } 223 | std::ostream & blue_on_light_yellow(std::ostream & os) { set("b", "ly"); return os; } 224 | std::ostream & blue_on_bright_white(std::ostream & os) { set("b", "bw"); return os; } 225 | std::ostream & green_on_black(std::ostream & os) { set("g", "k"); return os; } 226 | std::ostream & green_on_blue(std::ostream & os) { set("g", "b"); return os; } 227 | std::ostream & green_on_green(std::ostream & os) { set("g", "g"); return os; } 228 | std::ostream & green_on_aqua(std::ostream & os) { set("g", "a"); return os; } 229 | std::ostream & green_on_red(std::ostream & os) { set("g", "r"); return os; } 230 | std::ostream & green_on_purple(std::ostream & os) { set("g", "p"); return os; } 231 | std::ostream & green_on_yellow(std::ostream & os) { set("g", "y"); return os; } 232 | std::ostream & green_on_white(std::ostream & os) { set("g", "w"); return os; } 233 | std::ostream & green_on_grey(std::ostream & os) { set("g", "e"); return os; } 234 | std::ostream & green_on_light_blue(std::ostream & os) { set("g", "lb"); return os; } 235 | std::ostream & green_on_light_green(std::ostream & os) { set("g", "lg"); return os; } 236 | std::ostream & green_on_light_aqua(std::ostream & os) { set("g", "la"); return os; } 237 | std::ostream & green_on_light_red(std::ostream & os) { set("g", "lr"); return os; } 238 | std::ostream & green_on_light_purple(std::ostream & os) { set("g", "lp"); return os; } 239 | std::ostream & green_on_light_yellow(std::ostream & os) { set("g", "ly"); return os; } 240 | std::ostream & green_on_bright_white(std::ostream & os) { set("g", "bw"); return os; } 241 | std::ostream & aqua_on_black(std::ostream & os) { set("a", "k"); return os; } 242 | std::ostream & aqua_on_blue(std::ostream & os) { set("a", "b"); return os; } 243 | std::ostream & aqua_on_green(std::ostream & os) { set("a", "g"); return os; } 244 | std::ostream & aqua_on_aqua(std::ostream & os) { set("a", "a"); return os; } 245 | std::ostream & aqua_on_red(std::ostream & os) { set("a", "r"); return os; } 246 | std::ostream & aqua_on_purple(std::ostream & os) { set("a", "p"); return os; } 247 | std::ostream & aqua_on_yellow(std::ostream & os) { set("a", "y"); return os; } 248 | std::ostream & aqua_on_white(std::ostream & os) { set("a", "w"); return os; } 249 | std::ostream & aqua_on_grey(std::ostream & os) { set("a", "e"); return os; } 250 | std::ostream & aqua_on_light_blue(std::ostream & os) { set("a", "lb"); return os; } 251 | std::ostream & aqua_on_light_green(std::ostream & os) { set("a", "lg"); return os; } 252 | std::ostream & aqua_on_light_aqua(std::ostream & os) { set("a", "la"); return os; } 253 | std::ostream & aqua_on_light_red(std::ostream & os) { set("a", "lr"); return os; } 254 | std::ostream & aqua_on_light_purple(std::ostream & os) { set("a", "lp"); return os; } 255 | std::ostream & aqua_on_light_yellow(std::ostream & os) { set("a", "ly"); return os; } 256 | std::ostream & aqua_on_bright_white(std::ostream & os) { set("a", "bw"); return os; } 257 | std::ostream & red_on_black(std::ostream & os) { set("r", "k"); return os; } 258 | std::ostream & red_on_blue(std::ostream & os) { set("r", "b"); return os; } 259 | std::ostream & red_on_green(std::ostream & os) { set("r", "g"); return os; } 260 | std::ostream & red_on_aqua(std::ostream & os) { set("r", "a"); return os; } 261 | std::ostream & red_on_red(std::ostream & os) { set("r", "r"); return os; } 262 | std::ostream & red_on_purple(std::ostream & os) { set("r", "p"); return os; } 263 | std::ostream & red_on_yellow(std::ostream & os) { set("r", "y"); return os; } 264 | std::ostream & red_on_white(std::ostream & os) { set("r", "w"); return os; } 265 | std::ostream & red_on_grey(std::ostream & os) { set("r", "e"); return os; } 266 | std::ostream & red_on_light_blue(std::ostream & os) { set("r", "lb"); return os; } 267 | std::ostream & red_on_light_green(std::ostream & os) { set("r", "lg"); return os; } 268 | std::ostream & red_on_light_aqua(std::ostream & os) { set("r", "la"); return os; } 269 | std::ostream & red_on_light_red(std::ostream & os) { set("r", "lr"); return os; } 270 | std::ostream & red_on_light_purple(std::ostream & os) { set("r", "lp"); return os; } 271 | std::ostream & red_on_light_yellow(std::ostream & os) { set("r", "ly"); return os; } 272 | std::ostream & red_on_bright_white(std::ostream & os) { set("r", "bw"); return os; } 273 | std::ostream & purple_on_black(std::ostream & os) { set("p", "k"); return os; } 274 | std::ostream & purple_on_blue(std::ostream & os) { set("p", "b"); return os; } 275 | std::ostream & purple_on_green(std::ostream & os) { set("p", "g"); return os; } 276 | std::ostream & purple_on_aqua(std::ostream & os) { set("p", "a"); return os; } 277 | std::ostream & purple_on_red(std::ostream & os) { set("p", "r"); return os; } 278 | std::ostream & purple_on_purple(std::ostream & os) { set("p", "p"); return os; } 279 | std::ostream & purple_on_yellow(std::ostream & os) { set("p", "y"); return os; } 280 | std::ostream & purple_on_white(std::ostream & os) { set("p", "w"); return os; } 281 | std::ostream & purple_on_grey(std::ostream & os) { set("p", "e"); return os; } 282 | std::ostream & purple_on_light_blue(std::ostream & os) { set("p", "lb"); return os; } 283 | std::ostream & purple_on_light_green(std::ostream & os) { set("p", "lg"); return os; } 284 | std::ostream & purple_on_light_aqua(std::ostream & os) { set("p", "la"); return os; } 285 | std::ostream & purple_on_light_red(std::ostream & os) { set("p", "lr"); return os; } 286 | std::ostream & purple_on_light_purple(std::ostream & os) { set("p", "lp"); return os; } 287 | std::ostream & purple_on_light_yellow(std::ostream & os) { set("p", "ly"); return os; } 288 | std::ostream & purple_on_bright_white(std::ostream & os) { set("p", "bw"); return os; } 289 | std::ostream & yellow_on_black(std::ostream & os) { set("y", "k"); return os; } 290 | std::ostream & yellow_on_blue(std::ostream & os) { set("y", "b"); return os; } 291 | std::ostream & yellow_on_green(std::ostream & os) { set("y", "g"); return os; } 292 | std::ostream & yellow_on_aqua(std::ostream & os) { set("y", "a"); return os; } 293 | std::ostream & yellow_on_red(std::ostream & os) { set("y", "r"); return os; } 294 | std::ostream & yellow_on_purple(std::ostream & os) { set("y", "p"); return os; } 295 | std::ostream & yellow_on_yellow(std::ostream & os) { set("y", "y"); return os; } 296 | std::ostream & yellow_on_white(std::ostream & os) { set("y", "w"); return os; } 297 | std::ostream & yellow_on_grey(std::ostream & os) { set("y", "e"); return os; } 298 | std::ostream & yellow_on_light_blue(std::ostream & os) { set("y", "lb"); return os; } 299 | std::ostream & yellow_on_light_green(std::ostream & os) { set("y", "lg"); return os; } 300 | std::ostream & yellow_on_light_aqua(std::ostream & os) { set("y", "la"); return os; } 301 | std::ostream & yellow_on_light_red(std::ostream & os) { set("y", "lr"); return os; } 302 | std::ostream & yellow_on_light_purple(std::ostream & os) { set("y", "lp"); return os; } 303 | std::ostream & yellow_on_light_yellow(std::ostream & os) { set("y", "ly"); return os; } 304 | std::ostream & yellow_on_bright_white(std::ostream & os) { set("y", "bw"); return os; } 305 | std::ostream & white_on_black(std::ostream & os) { set("w", "k"); return os; } 306 | std::ostream & white_on_blue(std::ostream & os) { set("w", "b"); return os; } 307 | std::ostream & white_on_green(std::ostream & os) { set("w", "g"); return os; } 308 | std::ostream & white_on_aqua(std::ostream & os) { set("w", "a"); return os; } 309 | std::ostream & white_on_red(std::ostream & os) { set("w", "r"); return os; } 310 | std::ostream & white_on_purple(std::ostream & os) { set("w", "p"); return os; } 311 | std::ostream & white_on_yellow(std::ostream & os) { set("w", "y"); return os; } 312 | std::ostream & white_on_white(std::ostream & os) { set("w", "w"); return os; } 313 | std::ostream & white_on_grey(std::ostream & os) { set("w", "e"); return os; } 314 | std::ostream & white_on_light_blue(std::ostream & os) { set("w", "lb"); return os; } 315 | std::ostream & white_on_light_green(std::ostream & os) { set("w", "lg"); return os; } 316 | std::ostream & white_on_light_aqua(std::ostream & os) { set("w", "la"); return os; } 317 | std::ostream & white_on_light_red(std::ostream & os) { set("w", "lr"); return os; } 318 | std::ostream & white_on_light_purple(std::ostream & os) { set("w", "lp"); return os; } 319 | std::ostream & white_on_light_yellow(std::ostream & os) { set("w", "ly"); return os; } 320 | std::ostream & white_on_bright_white(std::ostream & os) { set("w", "bw"); return os; } 321 | std::ostream & grey_on_black(std::ostream & os) { set("e", "k"); return os; } 322 | std::ostream & grey_on_blue(std::ostream & os) { set("e", "b"); return os; } 323 | std::ostream & grey_on_green(std::ostream & os) { set("e", "g"); return os; } 324 | std::ostream & grey_on_aqua(std::ostream & os) { set("e", "a"); return os; } 325 | std::ostream & grey_on_red(std::ostream & os) { set("e", "r"); return os; } 326 | std::ostream & grey_on_purple(std::ostream & os) { set("e", "p"); return os; } 327 | std::ostream & grey_on_yellow(std::ostream & os) { set("e", "y"); return os; } 328 | std::ostream & grey_on_white(std::ostream & os) { set("e", "w"); return os; } 329 | std::ostream & grey_on_grey(std::ostream & os) { set("e", "e"); return os; } 330 | std::ostream & grey_on_light_blue(std::ostream & os) { set("e", "lb"); return os; } 331 | std::ostream & grey_on_light_green(std::ostream & os) { set("e", "lg"); return os; } 332 | std::ostream & grey_on_light_aqua(std::ostream & os) { set("e", "la"); return os; } 333 | std::ostream & grey_on_light_red(std::ostream & os) { set("e", "lr"); return os; } 334 | std::ostream & grey_on_light_purple(std::ostream & os) { set("e", "lp"); return os; } 335 | std::ostream & grey_on_light_yellow(std::ostream & os) { set("e", "ly"); return os; } 336 | std::ostream & grey_on_bright_white(std::ostream & os) { set("e", "bw"); return os; } 337 | std::ostream & light_blue_on_black(std::ostream & os) { set("lb", "k"); return os; } 338 | std::ostream & light_blue_on_blue(std::ostream & os) { set("lb", "b"); return os; } 339 | std::ostream & light_blue_on_green(std::ostream & os) { set("lb", "g"); return os; } 340 | std::ostream & light_blue_on_aqua(std::ostream & os) { set("lb", "a"); return os; } 341 | std::ostream & light_blue_on_red(std::ostream & os) { set("lb", "r"); return os; } 342 | std::ostream & light_blue_on_purple(std::ostream & os) { set("lb", "p"); return os; } 343 | std::ostream & light_blue_on_yellow(std::ostream & os) { set("lb", "y"); return os; } 344 | std::ostream & light_blue_on_white(std::ostream & os) { set("lb", "w"); return os; } 345 | std::ostream & light_blue_on_grey(std::ostream & os) { set("lb", "e"); return os; } 346 | std::ostream & light_blue_on_light_blue(std::ostream & os) { set("lb", "lb"); return os; } 347 | std::ostream & light_blue_on_light_green(std::ostream & os) { set("lb", "lg"); return os; } 348 | std::ostream & light_blue_on_light_aqua(std::ostream & os) { set("lb", "la"); return os; } 349 | std::ostream & light_blue_on_light_red(std::ostream & os) { set("lb", "lr"); return os; } 350 | std::ostream & light_blue_on_light_purple(std::ostream & os) { set("lb", "lp"); return os; } 351 | std::ostream & light_blue_on_light_yellow(std::ostream & os) { set("lb", "ly"); return os; } 352 | std::ostream & light_blue_on_bright_white(std::ostream & os) { set("lb", "bw"); return os; } 353 | std::ostream & light_green_on_black(std::ostream & os) { set("lg", "k"); return os; } 354 | std::ostream & light_green_on_blue(std::ostream & os) { set("lg", "b"); return os; } 355 | std::ostream & light_green_on_green(std::ostream & os) { set("lg", "g"); return os; } 356 | std::ostream & light_green_on_aqua(std::ostream & os) { set("lg", "a"); return os; } 357 | std::ostream & light_green_on_red(std::ostream & os) { set("lg", "r"); return os; } 358 | std::ostream & light_green_on_purple(std::ostream & os) { set("lg", "p"); return os; } 359 | std::ostream & light_green_on_yellow(std::ostream & os) { set("lg", "y"); return os; } 360 | std::ostream & light_green_on_white(std::ostream & os) { set("lg", "w"); return os; } 361 | std::ostream & light_green_on_grey(std::ostream & os) { set("lg", "e"); return os; } 362 | std::ostream & light_green_on_light_blue(std::ostream & os) { set("lg", "lb"); return os; } 363 | std::ostream & light_green_on_light_green(std::ostream & os) { set("lg", "lg"); return os; } 364 | std::ostream & light_green_on_light_aqua(std::ostream & os) { set("lg", "la"); return os; } 365 | std::ostream & light_green_on_light_red(std::ostream & os) { set("lg", "lr"); return os; } 366 | std::ostream & light_green_on_light_purple(std::ostream & os) { set("lg", "lp"); return os; } 367 | std::ostream & light_green_on_light_yellow(std::ostream & os) { set("lg", "ly"); return os; } 368 | std::ostream & light_green_on_bright_white(std::ostream & os) { set("lg", "bw"); return os; } 369 | std::ostream & light_aqua_on_black(std::ostream & os) { set("la", "k"); return os; } 370 | std::ostream & light_aqua_on_blue(std::ostream & os) { set("la", "b"); return os; } 371 | std::ostream & light_aqua_on_green(std::ostream & os) { set("la", "g"); return os; } 372 | std::ostream & light_aqua_on_aqua(std::ostream & os) { set("la", "a"); return os; } 373 | std::ostream & light_aqua_on_red(std::ostream & os) { set("la", "r"); return os; } 374 | std::ostream & light_aqua_on_purple(std::ostream & os) { set("la", "p"); return os; } 375 | std::ostream & light_aqua_on_yellow(std::ostream & os) { set("la", "y"); return os; } 376 | std::ostream & light_aqua_on_white(std::ostream & os) { set("la", "w"); return os; } 377 | std::ostream & light_aqua_on_grey(std::ostream & os) { set("la", "e"); return os; } 378 | std::ostream & light_aqua_on_light_blue(std::ostream & os) { set("la", "lb"); return os; } 379 | std::ostream & light_aqua_on_light_green(std::ostream & os) { set("la", "lg"); return os; } 380 | std::ostream & light_aqua_on_light_aqua(std::ostream & os) { set("la", "la"); return os; } 381 | std::ostream & light_aqua_on_light_red(std::ostream & os) { set("la", "lr"); return os; } 382 | std::ostream & light_aqua_on_light_purple(std::ostream & os) { set("la", "lp"); return os; } 383 | std::ostream & light_aqua_on_light_yellow(std::ostream & os) { set("la", "ly"); return os; } 384 | std::ostream & light_aqua_on_bright_white(std::ostream & os) { set("la", "bw"); return os; } 385 | std::ostream & light_red_on_black(std::ostream & os) { set("lr", "k"); return os; } 386 | std::ostream & light_red_on_blue(std::ostream & os) { set("lr", "b"); return os; } 387 | std::ostream & light_red_on_green(std::ostream & os) { set("lr", "g"); return os; } 388 | std::ostream & light_red_on_aqua(std::ostream & os) { set("lr", "a"); return os; } 389 | std::ostream & light_red_on_red(std::ostream & os) { set("lr", "r"); return os; } 390 | std::ostream & light_red_on_purple(std::ostream & os) { set("lr", "p"); return os; } 391 | std::ostream & light_red_on_yellow(std::ostream & os) { set("lr", "y"); return os; } 392 | std::ostream & light_red_on_white(std::ostream & os) { set("lr", "w"); return os; } 393 | std::ostream & light_red_on_grey(std::ostream & os) { set("lr", "e"); return os; } 394 | std::ostream & light_red_on_light_blue(std::ostream & os) { set("lr", "lb"); return os; } 395 | std::ostream & light_red_on_light_green(std::ostream & os) { set("lr", "lg"); return os; } 396 | std::ostream & light_red_on_light_aqua(std::ostream & os) { set("lr", "la"); return os; } 397 | std::ostream & light_red_on_light_red(std::ostream & os) { set("lr", "lr"); return os; } 398 | std::ostream & light_red_on_light_purple(std::ostream & os) { set("lr", "lp"); return os; } 399 | std::ostream & light_red_on_light_yellow(std::ostream & os) { set("lr", "ly"); return os; } 400 | std::ostream & light_red_on_bright_white(std::ostream & os) { set("lr", "bw"); return os; } 401 | std::ostream & light_purple_on_black(std::ostream & os) { set("lp", "k"); return os; } 402 | std::ostream & light_purple_on_blue(std::ostream & os) { set("lp", "b"); return os; } 403 | std::ostream & light_purple_on_green(std::ostream & os) { set("lp", "g"); return os; } 404 | std::ostream & light_purple_on_aqua(std::ostream & os) { set("lp", "a"); return os; } 405 | std::ostream & light_purple_on_red(std::ostream & os) { set("lp", "r"); return os; } 406 | std::ostream & light_purple_on_purple(std::ostream & os) { set("lp", "p"); return os; } 407 | std::ostream & light_purple_on_yellow(std::ostream & os) { set("lp", "y"); return os; } 408 | std::ostream & light_purple_on_white(std::ostream & os) { set("lp", "w"); return os; } 409 | std::ostream & light_purple_on_grey(std::ostream & os) { set("lp", "e"); return os; } 410 | std::ostream & light_purple_on_light_blue(std::ostream & os) { set("lp", "lb"); return os; } 411 | std::ostream & light_purple_on_light_green(std::ostream & os) { set("lp", "lg"); return os; } 412 | std::ostream & light_purple_on_light_aqua(std::ostream & os) { set("lp", "la"); return os; } 413 | std::ostream & light_purple_on_light_red(std::ostream & os) { set("lp", "lr"); return os; } 414 | std::ostream & light_purple_on_light_purple(std::ostream & os) { set("lp", "lp"); return os; } 415 | std::ostream & light_purple_on_light_yellow(std::ostream & os) { set("lp", "ly"); return os; } 416 | std::ostream & light_purple_on_bright_white(std::ostream & os) { set("lp", "bw"); return os; } 417 | std::ostream & light_yellow_on_black(std::ostream & os) { set("ly", "k"); return os; } 418 | std::ostream & light_yellow_on_blue(std::ostream & os) { set("ly", "b"); return os; } 419 | std::ostream & light_yellow_on_green(std::ostream & os) { set("ly", "g"); return os; } 420 | std::ostream & light_yellow_on_aqua(std::ostream & os) { set("ly", "a"); return os; } 421 | std::ostream & light_yellow_on_red(std::ostream & os) { set("ly", "r"); return os; } 422 | std::ostream & light_yellow_on_purple(std::ostream & os) { set("ly", "p"); return os; } 423 | std::ostream & light_yellow_on_yellow(std::ostream & os) { set("ly", "y"); return os; } 424 | std::ostream & light_yellow_on_white(std::ostream & os) { set("ly", "w"); return os; } 425 | std::ostream & light_yellow_on_grey(std::ostream & os) { set("ly", "e"); return os; } 426 | std::ostream & light_yellow_on_light_blue(std::ostream & os) { set("ly", "lb"); return os; } 427 | std::ostream & light_yellow_on_light_green(std::ostream & os) { set("ly", "lg"); return os; } 428 | std::ostream & light_yellow_on_light_aqua(std::ostream & os) { set("ly", "la"); return os; } 429 | std::ostream & light_yellow_on_light_red(std::ostream & os) { set("ly", "lr"); return os; } 430 | std::ostream & light_yellow_on_light_purple(std::ostream & os) { set("ly", "lp"); return os; } 431 | std::ostream & light_yellow_on_light_yellow(std::ostream & os) { set("ly", "ly"); return os; } 432 | std::ostream & light_yellow_on_bright_white(std::ostream & os) { set("ly", "bw"); return os; } 433 | std::ostream & bright_white_on_black(std::ostream & os) { set("bw", "k"); return os; } 434 | std::ostream & bright_white_on_blue(std::ostream & os) { set("bw", "b"); return os; } 435 | std::ostream & bright_white_on_green(std::ostream & os) { set("bw", "g"); return os; } 436 | std::ostream & bright_white_on_aqua(std::ostream & os) { set("bw", "a"); return os; } 437 | std::ostream & bright_white_on_red(std::ostream & os) { set("bw", "r"); return os; } 438 | std::ostream & bright_white_on_purple(std::ostream & os) { set("bw", "p"); return os; } 439 | std::ostream & bright_white_on_yellow(std::ostream & os) { set("bw", "y"); return os; } 440 | std::ostream & bright_white_on_white(std::ostream & os) { set("bw", "w"); return os; } 441 | std::ostream & bright_white_on_grey(std::ostream & os) { set("bw", "e"); return os; } 442 | std::ostream & bright_white_on_light_blue(std::ostream & os) { set("bw", "lb"); return os; } 443 | std::ostream & bright_white_on_light_green(std::ostream & os) { set("bw", "lg"); return os; } 444 | std::ostream & bright_white_on_light_aqua(std::ostream & os) { set("bw", "la"); return os; } 445 | std::ostream & bright_white_on_light_red(std::ostream & os) { set("bw", "lr"); return os; } 446 | std::ostream & bright_white_on_light_purple(std::ostream & os) { set("bw", "lp"); return os; } 447 | std::ostream & bright_white_on_light_yellow(std::ostream & os) { set("bw", "ly"); return os; } 448 | std::ostream & bright_white_on_bright_white(std::ostream & os) { set("bw", "bw"); return os; } 449 | } 450 | 451 | 452 | namespace dye 453 | { 454 | template 455 | using bar = typename std::conditional::value, std::string, T>::type; 456 | 457 | template class colorful; 458 | template class item; 459 | 460 | template 461 | class colorful : private std::list> 462 | { 463 | public: 464 | using std::list>::list; 465 | 466 | colorful & operator+=(const colorful & rhs) 467 | { 468 | this->insert(this->end(), rhs.begin(), rhs.end()); 469 | return *this; 470 | } 471 | 472 | colorful & operator+=(colorful && rhs) 473 | { 474 | this->splice(this->end(), std::move(rhs)); 475 | return *this; 476 | } 477 | 478 | colorful & operator+=(T t) 479 | { 480 | this->push_back(std::move(t)); 481 | return *this; 482 | } 483 | 484 | void push_front(T t) 485 | { 486 | this->std::list>::push_front(item(std::move(t))); 487 | } 488 | 489 | void push_back(T t) 490 | { 491 | this->std::list>::push_back(item(std::move(t))); 492 | } 493 | 494 | colorful & invert() 495 | { 496 | for (auto & elem : *this) 497 | elem.invert(); 498 | return *this; 499 | } 500 | 501 | template 502 | friend std::ostream & operator<<(std::ostream &, const colorful &); 503 | 504 | template 505 | friend colorful invert(colorful col); 506 | }; 507 | 508 | template 509 | colorful operator+(colorful lhs, colorful rhs) 510 | { 511 | colorful res(std::move(lhs)); 512 | return res += rhs; 513 | } 514 | 515 | template 516 | colorful operator+(colorful lhs, std::string rhs) 517 | { 518 | colorful res(std::move(lhs)); 519 | res.push_back(std::move(rhs)); 520 | return res; 521 | } 522 | 523 | template 524 | colorful operator+(const std::string & lhs, colorful rhs) 525 | { 526 | colorful res(std::move(rhs)); 527 | res.push_front(std::move(lhs)); 528 | return res; 529 | } 530 | 531 | template 532 | std::ostream & operator<<(std::ostream & os, const colorful & colorful) 533 | { 534 | for (const auto & elem : colorful) 535 | os << elem; 536 | return os; 537 | } 538 | 539 | template 540 | colorful invert(colorful col) 541 | { 542 | colorful res(std::move(col)); 543 | for (auto & elem : res) 544 | elem.invert(); 545 | return res; 546 | } 547 | 548 | template 549 | class item 550 | { 551 | T thing; 552 | int color; 553 | 554 | public: 555 | item(T t) : thing(std::move(t)), color(hue::get()) {} 556 | item(T t, int a) : thing(std::move(t)), color(hue::itoc(a)) {} 557 | item(T t, int a, int b) : thing(std::move(t)), color(hue::itoc(a, b)) {} 558 | item(T t, std::string a) : thing(std::move(t)), color(hue::stoc(a)) {} 559 | item(T t, std::string a, std::string b) : thing(std::move(t)), color(hue::stoc(a, b)) {} 560 | 561 | item & invert() 562 | { 563 | color = hue::invert(color); 564 | return *this; 565 | } 566 | 567 | template 568 | friend class colorful; 569 | 570 | template 571 | friend std::ostream & operator<<(std::ostream &, const item &); 572 | }; 573 | 574 | template 575 | std::ostream & operator<<(std::ostream & os, const item & it) 576 | { 577 | hue::set(it.color); 578 | os << it.thing; 579 | hue::reset(); 580 | return os; 581 | } 582 | 583 | template using R = colorful>; 584 | template using S = item>; 585 | 586 | template R colorize(T t, std::string a) { return R { S(t, a) }; } 587 | template R vanilla(T t) { return R { S(t) }; } 588 | template R black(T t) { return R { S(t, "k") }; } 589 | template R blue(T t) { return R { S(t, "b") }; } 590 | template R green(T t) { return R { S(t, "g") }; } 591 | template R aqua(T t) { return R { S(t, "a") }; } 592 | template R red(T t) { return R { S(t, "r") }; } 593 | template R purple(T t) { return R { S(t, "p") }; } 594 | template R yellow(T t) { return R { S(t, "y") }; } 595 | template R white(T t) { return R { S(t, "w") }; } 596 | template R grey(T t) { return R { S(t, "e") }; } 597 | template R light_blue(T t) { return R { S(t, "lb") }; } 598 | template R light_green(T t) { return R { S(t, "lg") }; } 599 | template R light_aqua(T t) { return R { S(t, "la") }; } 600 | template R light_red(T t) { return R { S(t, "lr") }; } 601 | template R light_purple(T t) { return R { S(t, "lp") }; } 602 | template R light_yellow(T t) { return R { S(t, "ly") }; } 603 | template R bright_white(T t) { return R { S(t, "bw") }; } 604 | template R on_black(T t) { return R { S(t, "k", "k") }; } 605 | template R on_blue(T t) { return R { S(t, "k", "b") }; } 606 | template R on_green(T t) { return R { S(t, "k", "g") }; } 607 | template R on_aqua(T t) { return R { S(t, "k", "a") }; } 608 | template R on_red(T t) { return R { S(t, "k", "r") }; } 609 | template R on_purple(T t) { return R { S(t, "k", "p") }; } 610 | template R on_yellow(T t) { return R { S(t, "k", "y") }; } 611 | template R on_white(T t) { return R { S(t, "k", "w") }; } 612 | template R on_grey(T t) { return R { S(t, "k", "e") }; } 613 | template R on_light_blue(T t) { return R { S(t, "k", "lb") }; } 614 | template R on_light_green(T t) { return R { S(t, "k", "lg") }; } 615 | template R on_light_aqua(T t) { return R { S(t, "k", "la") }; } 616 | template R on_light_red(T t) { return R { S(t, "k", "lr") }; } 617 | template R on_light_purple(T t) { return R { S(t, "k", "lp") }; } 618 | template R on_light_yellow(T t) { return R { S(t, "k", "ly") }; } 619 | template R on_bright_white(T t) { return R { S(t, "k", "bw") }; } 620 | template R black_on_black(T t) { return R { S(t, "k", "k") }; } 621 | template R black_on_blue(T t) { return R { S(t, "k", "b") }; } 622 | template R black_on_green(T t) { return R { S(t, "k", "g") }; } 623 | template R black_on_aqua(T t) { return R { S(t, "k", "a") }; } 624 | template R black_on_red(T t) { return R { S(t, "k", "r") }; } 625 | template R black_on_purple(T t) { return R { S(t, "k", "p") }; } 626 | template R black_on_yellow(T t) { return R { S(t, "k", "y") }; } 627 | template R black_on_white(T t) { return R { S(t, "k", "w") }; } 628 | template R black_on_grey(T t) { return R { S(t, "k", "e") }; } 629 | template R black_on_light_blue(T t) { return R { S(t, "k", "lb") }; } 630 | template R black_on_light_green(T t) { return R { S(t, "k", "lg") }; } 631 | template R black_on_light_aqua(T t) { return R { S(t, "k", "la") }; } 632 | template R black_on_light_red(T t) { return R { S(t, "k", "lr") }; } 633 | template R black_on_light_purple(T t) { return R { S(t, "k", "lp") }; } 634 | template R black_on_light_yellow(T t) { return R { S(t, "k", "ly") }; } 635 | template R black_on_bright_white(T t) { return R { S(t, "k", "bw") }; } 636 | template R blue_on_black(T t) { return R { S(t, "b", "k") }; } 637 | template R blue_on_blue(T t) { return R { S(t, "b", "b") }; } 638 | template R blue_on_green(T t) { return R { S(t, "b", "g") }; } 639 | template R blue_on_aqua(T t) { return R { S(t, "b", "a") }; } 640 | template R blue_on_red(T t) { return R { S(t, "b", "r") }; } 641 | template R blue_on_purple(T t) { return R { S(t, "b", "p") }; } 642 | template R blue_on_yellow(T t) { return R { S(t, "b", "y") }; } 643 | template R blue_on_white(T t) { return R { S(t, "b", "w") }; } 644 | template R blue_on_grey(T t) { return R { S(t, "b", "e") }; } 645 | template R blue_on_light_blue(T t) { return R { S(t, "b", "lb") }; } 646 | template R blue_on_light_green(T t) { return R { S(t, "b", "lg") }; } 647 | template R blue_on_light_aqua(T t) { return R { S(t, "b", "la") }; } 648 | template R blue_on_light_red(T t) { return R { S(t, "b", "lr") }; } 649 | template R blue_on_light_purple(T t) { return R { S(t, "b", "lp") }; } 650 | template R blue_on_light_yellow(T t) { return R { S(t, "b", "ly") }; } 651 | template R blue_on_bright_white(T t) { return R { S(t, "b", "bw") }; } 652 | template R green_on_black(T t) { return R { S(t, "g", "k") }; } 653 | template R green_on_blue(T t) { return R { S(t, "g", "b") }; } 654 | template R green_on_green(T t) { return R { S(t, "g", "g") }; } 655 | template R green_on_aqua(T t) { return R { S(t, "g", "a") }; } 656 | template R green_on_red(T t) { return R { S(t, "g", "r") }; } 657 | template R green_on_purple(T t) { return R { S(t, "g", "p") }; } 658 | template R green_on_yellow(T t) { return R { S(t, "g", "y") }; } 659 | template R green_on_white(T t) { return R { S(t, "g", "w") }; } 660 | template R green_on_grey(T t) { return R { S(t, "g", "e") }; } 661 | template R green_on_light_blue(T t) { return R { S(t, "g", "lb") }; } 662 | template R green_on_light_green(T t) { return R { S(t, "g", "lg") }; } 663 | template R green_on_light_aqua(T t) { return R { S(t, "g", "la") }; } 664 | template R green_on_light_red(T t) { return R { S(t, "g", "lr") }; } 665 | template R green_on_light_purple(T t) { return R { S(t, "g", "lp") }; } 666 | template R green_on_light_yellow(T t) { return R { S(t, "g", "ly") }; } 667 | template R green_on_bright_white(T t) { return R { S(t, "g", "bw") }; } 668 | template R aqua_on_black(T t) { return R { S(t, "a", "k") }; } 669 | template R aqua_on_blue(T t) { return R { S(t, "a", "b") }; } 670 | template R aqua_on_green(T t) { return R { S(t, "a", "g") }; } 671 | template R aqua_on_aqua(T t) { return R { S(t, "a", "a") }; } 672 | template R aqua_on_red(T t) { return R { S(t, "a", "r") }; } 673 | template R aqua_on_purple(T t) { return R { S(t, "a", "p") }; } 674 | template R aqua_on_yellow(T t) { return R { S(t, "a", "y") }; } 675 | template R aqua_on_white(T t) { return R { S(t, "a", "w") }; } 676 | template R aqua_on_grey(T t) { return R { S(t, "a", "e") }; } 677 | template R aqua_on_light_blue(T t) { return R { S(t, "a", "lb") }; } 678 | template R aqua_on_light_green(T t) { return R { S(t, "a", "lg") }; } 679 | template R aqua_on_light_aqua(T t) { return R { S(t, "a", "la") }; } 680 | template R aqua_on_light_red(T t) { return R { S(t, "a", "lr") }; } 681 | template R aqua_on_light_purple(T t) { return R { S(t, "a", "lp") }; } 682 | template R aqua_on_light_yellow(T t) { return R { S(t, "a", "ly") }; } 683 | template R aqua_on_bright_white(T t) { return R { S(t, "a", "bw") }; } 684 | template R red_on_black(T t) { return R { S(t, "r", "k") }; } 685 | template R red_on_blue(T t) { return R { S(t, "r", "b") }; } 686 | template R red_on_green(T t) { return R { S(t, "r", "g") }; } 687 | template R red_on_aqua(T t) { return R { S(t, "r", "a") }; } 688 | template R red_on_red(T t) { return R { S(t, "r", "r") }; } 689 | template R red_on_purple(T t) { return R { S(t, "r", "p") }; } 690 | template R red_on_yellow(T t) { return R { S(t, "r", "y") }; } 691 | template R red_on_white(T t) { return R { S(t, "r", "w") }; } 692 | template R red_on_grey(T t) { return R { S(t, "r", "e") }; } 693 | template R red_on_light_blue(T t) { return R { S(t, "r", "lb") }; } 694 | template R red_on_light_green(T t) { return R { S(t, "r", "lg") }; } 695 | template R red_on_light_aqua(T t) { return R { S(t, "r", "la") }; } 696 | template R red_on_light_red(T t) { return R { S(t, "r", "lr") }; } 697 | template R red_on_light_purple(T t) { return R { S(t, "r", "lp") }; } 698 | template R red_on_light_yellow(T t) { return R { S(t, "r", "ly") }; } 699 | template R red_on_bright_white(T t) { return R { S(t, "r", "bw") }; } 700 | template R purple_on_black(T t) { return R { S(t, "p", "k") }; } 701 | template R purple_on_blue(T t) { return R { S(t, "p", "b") }; } 702 | template R purple_on_green(T t) { return R { S(t, "p", "g") }; } 703 | template R purple_on_aqua(T t) { return R { S(t, "p", "a") }; } 704 | template R purple_on_red(T t) { return R { S(t, "p", "r") }; } 705 | template R purple_on_purple(T t) { return R { S(t, "p", "p") }; } 706 | template R purple_on_yellow(T t) { return R { S(t, "p", "y") }; } 707 | template R purple_on_white(T t) { return R { S(t, "p", "w") }; } 708 | template R purple_on_grey(T t) { return R { S(t, "p", "e") }; } 709 | template R purple_on_light_blue(T t) { return R { S(t, "p", "lb") }; } 710 | template R purple_on_light_green(T t) { return R { S(t, "p", "lg") }; } 711 | template R purple_on_light_aqua(T t) { return R { S(t, "p", "la") }; } 712 | template R purple_on_light_red(T t) { return R { S(t, "p", "lr") }; } 713 | template R purple_on_light_purple(T t) { return R { S(t, "p", "lp") }; } 714 | template R purple_on_light_yellow(T t) { return R { S(t, "p", "ly") }; } 715 | template R purple_on_bright_white(T t) { return R { S(t, "p", "bw") }; } 716 | template R yellow_on_black(T t) { return R { S(t, "y", "k") }; } 717 | template R yellow_on_blue(T t) { return R { S(t, "y", "b") }; } 718 | template R yellow_on_green(T t) { return R { S(t, "y", "g") }; } 719 | template R yellow_on_aqua(T t) { return R { S(t, "y", "a") }; } 720 | template R yellow_on_red(T t) { return R { S(t, "y", "r") }; } 721 | template R yellow_on_purple(T t) { return R { S(t, "y", "p") }; } 722 | template R yellow_on_yellow(T t) { return R { S(t, "y", "y") }; } 723 | template R yellow_on_white(T t) { return R { S(t, "y", "w") }; } 724 | template R yellow_on_grey(T t) { return R { S(t, "y", "e") }; } 725 | template R yellow_on_light_blue(T t) { return R { S(t, "y", "lb") }; } 726 | template R yellow_on_light_green(T t) { return R { S(t, "y", "lg") }; } 727 | template R yellow_on_light_aqua(T t) { return R { S(t, "y", "la") }; } 728 | template R yellow_on_light_red(T t) { return R { S(t, "y", "lr") }; } 729 | template R yellow_on_light_purple(T t) { return R { S(t, "y", "lp") }; } 730 | template R yellow_on_light_yellow(T t) { return R { S(t, "y", "ly") }; } 731 | template R yellow_on_bright_white(T t) { return R { S(t, "y", "bw") }; } 732 | template R white_on_black(T t) { return R { S(t, "w", "k") }; } 733 | template R white_on_blue(T t) { return R { S(t, "w", "b") }; } 734 | template R white_on_green(T t) { return R { S(t, "w", "g") }; } 735 | template R white_on_aqua(T t) { return R { S(t, "w", "a") }; } 736 | template R white_on_red(T t) { return R { S(t, "w", "r") }; } 737 | template R white_on_purple(T t) { return R { S(t, "w", "p") }; } 738 | template R white_on_yellow(T t) { return R { S(t, "w", "y") }; } 739 | template R white_on_white(T t) { return R { S(t, "w", "w") }; } 740 | template R white_on_grey(T t) { return R { S(t, "w", "e") }; } 741 | template R white_on_light_blue(T t) { return R { S(t, "w", "lb") }; } 742 | template R white_on_light_green(T t) { return R { S(t, "w", "lg") }; } 743 | template R white_on_light_aqua(T t) { return R { S(t, "w", "la") }; } 744 | template R white_on_light_red(T t) { return R { S(t, "w", "lr") }; } 745 | template R white_on_light_purple(T t) { return R { S(t, "w", "lp") }; } 746 | template R white_on_light_yellow(T t) { return R { S(t, "w", "ly") }; } 747 | template R white_on_bright_white(T t) { return R { S(t, "w", "bw") }; } 748 | template R grey_on_black(T t) { return R { S(t, "e", "k") }; } 749 | template R grey_on_blue(T t) { return R { S(t, "e", "b") }; } 750 | template R grey_on_green(T t) { return R { S(t, "e", "g") }; } 751 | template R grey_on_aqua(T t) { return R { S(t, "e", "a") }; } 752 | template R grey_on_red(T t) { return R { S(t, "e", "r") }; } 753 | template R grey_on_purple(T t) { return R { S(t, "e", "p") }; } 754 | template R grey_on_yellow(T t) { return R { S(t, "e", "y") }; } 755 | template R grey_on_white(T t) { return R { S(t, "e", "w") }; } 756 | template R grey_on_grey(T t) { return R { S(t, "e", "e") }; } 757 | template R grey_on_light_blue(T t) { return R { S(t, "e", "lb") }; } 758 | template R grey_on_light_green(T t) { return R { S(t, "e", "lg") }; } 759 | template R grey_on_light_aqua(T t) { return R { S(t, "e", "la") }; } 760 | template R grey_on_light_red(T t) { return R { S(t, "e", "lr") }; } 761 | template R grey_on_light_purple(T t) { return R { S(t, "e", "lp") }; } 762 | template R grey_on_light_yellow(T t) { return R { S(t, "e", "ly") }; } 763 | template R grey_on_bright_white(T t) { return R { S(t, "e", "bw") }; } 764 | template R light_blue_on_black(T t) { return R { S(t, "lb", "k") }; } 765 | template R light_blue_on_blue(T t) { return R { S(t, "lb", "b") }; } 766 | template R light_blue_on_green(T t) { return R { S(t, "lb", "g") }; } 767 | template R light_blue_on_aqua(T t) { return R { S(t, "lb", "a") }; } 768 | template R light_blue_on_red(T t) { return R { S(t, "lb", "r") }; } 769 | template R light_blue_on_purple(T t) { return R { S(t, "lb", "p") }; } 770 | template R light_blue_on_yellow(T t) { return R { S(t, "lb", "y") }; } 771 | template R light_blue_on_white(T t) { return R { S(t, "lb", "w") }; } 772 | template R light_blue_on_grey(T t) { return R { S(t, "lb", "e") }; } 773 | template R light_blue_on_light_blue(T t) { return R { S(t, "lb", "lb") }; } 774 | template R light_blue_on_light_green(T t) { return R { S(t, "lb", "lg") }; } 775 | template R light_blue_on_light_aqua(T t) { return R { S(t, "lb", "la") }; } 776 | template R light_blue_on_light_red(T t) { return R { S(t, "lb", "lr") }; } 777 | template R light_blue_on_light_purple(T t) { return R { S(t, "lb", "lp") }; } 778 | template R light_blue_on_light_yellow(T t) { return R { S(t, "lb", "ly") }; } 779 | template R light_blue_on_bright_white(T t) { return R { S(t, "lb", "bw") }; } 780 | template R light_green_on_black(T t) { return R { S(t, "lg", "k") }; } 781 | template R light_green_on_blue(T t) { return R { S(t, "lg", "b") }; } 782 | template R light_green_on_green(T t) { return R { S(t, "lg", "g") }; } 783 | template R light_green_on_aqua(T t) { return R { S(t, "lg", "a") }; } 784 | template R light_green_on_red(T t) { return R { S(t, "lg", "r") }; } 785 | template R light_green_on_purple(T t) { return R { S(t, "lg", "p") }; } 786 | template R light_green_on_yellow(T t) { return R { S(t, "lg", "y") }; } 787 | template R light_green_on_white(T t) { return R { S(t, "lg", "w") }; } 788 | template R light_green_on_grey(T t) { return R { S(t, "lg", "e") }; } 789 | template R light_green_on_light_blue(T t) { return R { S(t, "lg", "lb") }; } 790 | template R light_green_on_light_green(T t) { return R { S(t, "lg", "lg") }; } 791 | template R light_green_on_light_aqua(T t) { return R { S(t, "lg", "la") }; } 792 | template R light_green_on_light_red(T t) { return R { S(t, "lg", "lr") }; } 793 | template R light_green_on_light_purple(T t) { return R { S(t, "lg", "lp") }; } 794 | template R light_green_on_light_yellow(T t) { return R { S(t, "lg", "ly") }; } 795 | template R light_green_on_bright_white(T t) { return R { S(t, "lg", "bw") }; } 796 | template R light_aqua_on_black(T t) { return R { S(t, "la", "k") }; } 797 | template R light_aqua_on_blue(T t) { return R { S(t, "la", "b") }; } 798 | template R light_aqua_on_green(T t) { return R { S(t, "la", "g") }; } 799 | template R light_aqua_on_aqua(T t) { return R { S(t, "la", "a") }; } 800 | template R light_aqua_on_red(T t) { return R { S(t, "la", "r") }; } 801 | template R light_aqua_on_purple(T t) { return R { S(t, "la", "p") }; } 802 | template R light_aqua_on_yellow(T t) { return R { S(t, "la", "y") }; } 803 | template R light_aqua_on_white(T t) { return R { S(t, "la", "w") }; } 804 | template R light_aqua_on_grey(T t) { return R { S(t, "la", "e") }; } 805 | template R light_aqua_on_light_blue(T t) { return R { S(t, "la", "lb") }; } 806 | template R light_aqua_on_light_green(T t) { return R { S(t, "la", "lg") }; } 807 | template R light_aqua_on_light_aqua(T t) { return R { S(t, "la", "la") }; } 808 | template R light_aqua_on_light_red(T t) { return R { S(t, "la", "lr") }; } 809 | template R light_aqua_on_light_purple(T t) { return R { S(t, "la", "lp") }; } 810 | template R light_aqua_on_light_yellow(T t) { return R { S(t, "la", "ly") }; } 811 | template R light_aqua_on_bright_white(T t) { return R { S(t, "la", "bw") }; } 812 | template R light_red_on_black(T t) { return R { S(t, "lr", "k") }; } 813 | template R light_red_on_blue(T t) { return R { S(t, "lr", "b") }; } 814 | template R light_red_on_green(T t) { return R { S(t, "lr", "g") }; } 815 | template R light_red_on_aqua(T t) { return R { S(t, "lr", "a") }; } 816 | template R light_red_on_red(T t) { return R { S(t, "lr", "r") }; } 817 | template R light_red_on_purple(T t) { return R { S(t, "lr", "p") }; } 818 | template R light_red_on_yellow(T t) { return R { S(t, "lr", "y") }; } 819 | template R light_red_on_white(T t) { return R { S(t, "lr", "w") }; } 820 | template R light_red_on_grey(T t) { return R { S(t, "lr", "e") }; } 821 | template R light_red_on_light_blue(T t) { return R { S(t, "lr", "lb") }; } 822 | template R light_red_on_light_green(T t) { return R { S(t, "lr", "lg") }; } 823 | template R light_red_on_light_aqua(T t) { return R { S(t, "lr", "la") }; } 824 | template R light_red_on_light_red(T t) { return R { S(t, "lr", "lr") }; } 825 | template R light_red_on_light_purple(T t) { return R { S(t, "lr", "lp") }; } 826 | template R light_red_on_light_yellow(T t) { return R { S(t, "lr", "ly") }; } 827 | template R light_red_on_bright_white(T t) { return R { S(t, "lr", "bw") }; } 828 | template R light_purple_on_black(T t) { return R { S(t, "lp", "k") }; } 829 | template R light_purple_on_blue(T t) { return R { S(t, "lp", "b") }; } 830 | template R light_purple_on_green(T t) { return R { S(t, "lp", "g") }; } 831 | template R light_purple_on_aqua(T t) { return R { S(t, "lp", "a") }; } 832 | template R light_purple_on_red(T t) { return R { S(t, "lp", "r") }; } 833 | template R light_purple_on_purple(T t) { return R { S(t, "lp", "p") }; } 834 | template R light_purple_on_yellow(T t) { return R { S(t, "lp", "y") }; } 835 | template R light_purple_on_white(T t) { return R { S(t, "lp", "w") }; } 836 | template R light_purple_on_grey(T t) { return R { S(t, "lp", "e") }; } 837 | template R light_purple_on_light_blue(T t) { return R { S(t, "lp", "lb") }; } 838 | template R light_purple_on_light_green(T t) { return R { S(t, "lp", "lg") }; } 839 | template R light_purple_on_light_aqua(T t) { return R { S(t, "lp", "la") }; } 840 | template R light_purple_on_light_red(T t) { return R { S(t, "lp", "lr") }; } 841 | template R light_purple_on_light_purple(T t) { return R { S(t, "lp", "lp") }; } 842 | template R light_purple_on_light_yellow(T t) { return R { S(t, "lp", "ly") }; } 843 | template R light_purple_on_bright_white(T t) { return R { S(t, "lp", "bw") }; } 844 | template R light_yellow_on_black(T t) { return R { S(t, "ly", "k") }; } 845 | template R light_yellow_on_blue(T t) { return R { S(t, "ly", "b") }; } 846 | template R light_yellow_on_green(T t) { return R { S(t, "ly", "g") }; } 847 | template R light_yellow_on_aqua(T t) { return R { S(t, "ly", "a") }; } 848 | template R light_yellow_on_red(T t) { return R { S(t, "ly", "r") }; } 849 | template R light_yellow_on_purple(T t) { return R { S(t, "ly", "p") }; } 850 | template R light_yellow_on_yellow(T t) { return R { S(t, "ly", "y") }; } 851 | template R light_yellow_on_white(T t) { return R { S(t, "ly", "w") }; } 852 | template R light_yellow_on_grey(T t) { return R { S(t, "ly", "e") }; } 853 | template R light_yellow_on_light_blue(T t) { return R { S(t, "ly", "lb") }; } 854 | template R light_yellow_on_light_green(T t) { return R { S(t, "ly", "lg") }; } 855 | template R light_yellow_on_light_aqua(T t) { return R { S(t, "ly", "la") }; } 856 | template R light_yellow_on_light_red(T t) { return R { S(t, "ly", "lr") }; } 857 | template R light_yellow_on_light_purple(T t) { return R { S(t, "ly", "lp") }; } 858 | template R light_yellow_on_light_yellow(T t) { return R { S(t, "ly", "ly") }; } 859 | template R light_yellow_on_bright_white(T t) { return R { S(t, "ly", "bw") }; } 860 | template R bright_white_on_black(T t) { return R { S(t, "bw", "k") }; } 861 | template R bright_white_on_blue(T t) { return R { S(t, "bw", "b") }; } 862 | template R bright_white_on_green(T t) { return R { S(t, "bw", "g") }; } 863 | template R bright_white_on_aqua(T t) { return R { S(t, "bw", "a") }; } 864 | template R bright_white_on_red(T t) { return R { S(t, "bw", "r") }; } 865 | template R bright_white_on_purple(T t) { return R { S(t, "bw", "p") }; } 866 | template R bright_white_on_yellow(T t) { return R { S(t, "bw", "y") }; } 867 | template R bright_white_on_white(T t) { return R { S(t, "bw", "w") }; } 868 | template R bright_white_on_grey(T t) { return R { S(t, "bw", "e") }; } 869 | template R bright_white_on_light_blue(T t) { return R { S(t, "bw", "lb") }; } 870 | template R bright_white_on_light_green(T t) { return R { S(t, "bw", "lg") }; } 871 | template R bright_white_on_light_aqua(T t) { return R { S(t, "bw", "la") }; } 872 | template R bright_white_on_light_red(T t) { return R { S(t, "bw", "lr") }; } 873 | template R bright_white_on_light_purple(T t) { return R { S(t, "bw", "lp") }; } 874 | template R bright_white_on_light_yellow(T t) { return R { S(t, "bw", "ly") }; } 875 | template R bright_white_on_bright_white(T t) { return R { S(t, "bw", "bw") }; } 876 | } 877 | 878 | #endif 879 | --------------------------------------------------------------------------------