Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ostream>
- namespace Color {
- enum Code {
- FG_RED = 31,
- FG_GREEN = 32,
- FG_BLUE = 34,
- FG_DEFAULT = 39,
- BG_RED = 41,
- BG_GREEN = 42,
- BG_BLUE = 44,
- BG_DEFAULT = 49
- };
- std::ostream& operator<<(std::ostream& os, Code code) {
- return os << "\033[" << static_cast<int>(code) << "m";
- }
- }
- #include <iostream>
- using namespace std;
- int main() {
- cout << "This ->" << Color::FG_RED << "word"
- << Color::FG_DEFAULT << "<- is red." << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement