MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / init_console_color

Function init_console_color

src/cli/main.cpp:192–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190bool g_use_color = false;
191
192void init_console_color() {
193#ifdef _WIN32
194 HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
195 DWORD mode = 0;
196 if (h != INVALID_HANDLE_VALUE && GetConsoleMode(h, &mode))
197 SetConsoleMode(h, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
198 const bool tty = _isatty(_fileno(stdout)) != 0;
199#else
200 const bool tty = isatty(fileno(stdout)) != 0;
201#endif
202 g_use_color = tty && std::getenv("NO_COLOR") == nullptr;
203}
204
205template <typename... A>
206void cprint(const fmt::text_style& st, fmt::format_string<A...> f, A&&... a) {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected