Extremely minimal color printing utilities for C++.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(colors): Added special attributes.

+43 -1
build/a.out

This is a binary file and will not be displayed.

+31
src/colors.cc
··· 1 1 #include "colors.hpp" 2 + #include <string> 2 3 3 4 namespace colors { 4 5 func black(std::string str) noexcept -> std::string { ··· 39 40 40 41 func cyan(std::string str) noexcept -> std::string { 41 42 auto const prefix = "\033[36m"; 43 + auto const suffix = "\033[0m"; 44 + return prefix + str + suffix; 45 + } 46 + 47 + func bold(std::string str) noexcept -> std::string { 48 + auto const prefix = "\033[1m"; 49 + auto const suffix = "\033[0m"; 50 + return prefix + str + suffix; 51 + } 52 + 53 + func underline(std::string str) noexcept -> std::string { 54 + auto const prefix = "\033[4m"; 55 + auto const suffix = "\033[0m"; 56 + return prefix + str + suffix; 57 + } 58 + 59 + func italic(std::string str) noexcept -> std::string { 60 + auto const prefix = "\033[3m"; 61 + auto const suffix = "\033[0m"; 62 + return prefix + str + suffix; 63 + } 64 + 65 + func faint(std::string str) noexcept -> std::string { 66 + auto const prefix = "\033[2m"; 67 + auto const suffix = "\033[0m"; 68 + return prefix + str + suffix; 69 + } 70 + 71 + func blink(std::string str) noexcept -> std::string { 72 + auto const prefix = "\033[5m"; 42 73 auto const suffix = "\033[0m"; 43 74 return prefix + str + suffix; 44 75 }
+10
src/colors.hpp
··· 15 15 func magenta(std::string str) noexcept -> std::string; 16 16 17 17 func cyan(std::string str) noexcept -> std::string; 18 + 19 + func bold(std::string str) noexcept -> std::string; 20 + 21 + func underline(std::string str) noexcept -> std::string; 22 + 23 + func italic(std::string str) noexcept -> std::string; 24 + 25 + func faint(std::string str) noexcept -> std::string; 26 + 27 + func blink(std::string str) noexcept -> std::string; 18 28 }
+2 -1
src/main.cc
··· 1 1 #include <string> 2 2 #include <iostream> 3 3 #include "colors.hpp" 4 + using namespace colors; 4 5 #define func auto 5 6 6 7 func main() noexcept -> int 7 8 { 8 - std::cout << colors::red("hello there") << std::endl; 9 + std::cout << blink(bold(red(" "))) << std::endl; 9 10 return 0; 10 11 }