开发者

How can I make the console output brighter on cygwin?

开发者 https://www.devze.com 2023-03-17 18:13 出处:网络
printf statements with colour codes appear very brightly on Linux. #define DBG_YELLOW\"\\033[33m\" fprintf(stderr, DBG_YELLOW\"%s %s\\n\"DBG_NORMAL, area, msg);

printf statements with colour codes appear very brightly on Linux.

#define DBG_YELLOW      "\033[33m"
fprintf(stderr, DBG_YELLOW"%s %s\n"DBG_NORMAL, area, msg);

However those same printf's with colour codes appear quite dull 开发者_JAVA技巧on cygwin.

any ideas what I can do to brighten them?


The colors for MinTTY can be changed, it seems. On Cygwin, you have the Windows terminal, MinTTY and rxvt as terminals. I'd say MinTTY is by far the best of those.

Haha, good news: MinTTY now allows you to change the 16 default ANSI colors, see the section "Changing colours"!

And also see this other question to pimp your cmd.exe prompt using colors.


MS-DOS (ansi.sys) and a fair number of terminals dual-purpose [1m as bold or bright, and you can usually toggle this behaviour in the configuration.

You can either do \033[1m\033[33m, or the compound, \033[33;1m, to give you your bright color.

Be warned tho', ANSI codes are notoriously inconsistent. Orange could be brown on one terminal, bold can be blink on another. Rather than doing it by hand, look into one of the many tried-and-true libraries like ncurses which have done all of the work for you, should you care about portability.

0

精彩评论

暂无评论...
验证码 换一张
取 消