MCPcopy Create free account
hub / github.com/DFHack/dfhack / getANSIColor

Function getANSIColor

library/Console-posix.cpp:113–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111const char * RESETCOLOR = "\033[0m";
112
113const char * getANSIColor(const int c)
114{
115 switch (c)
116 {
117 case -1: return RESETCOLOR; // HACK! :P
118 case 0 : return ANSI_BLACK;
119 case 1 : return ANSI_BLUE; // non-ANSI
120 case 2 : return ANSI_GREEN;
121 case 3 : return ANSI_CYAN; // non-ANSI
122 case 4 : return ANSI_RED; // non-ANSI
123 case 5 : return ANSI_MAGENTA;
124 case 6 : return ANSI_BROWN;
125 case 7 : return ANSI_GREY;
126 case 8 : return ANSI_DARKGREY;
127 case 9 : return ANSI_LIGHTBLUE; // non-ANSI
128 case 10: return ANSI_LIGHTGREEN;
129 case 11: return ANSI_LIGHTCYAN; // non-ANSI;
130 case 12: return ANSI_LIGHTRED; // non-ANSI;
131 case 13: return ANSI_LIGHTMAGENTA;
132 case 14: return ANSI_YELLOW; // non-ANSI
133 case 15: return ANSI_WHITE;
134 default: return "";
135 }
136}
137
138
139#ifdef HAVE_CUCHAR

Callers 1

colorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected