Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Er, why would you want all the text to be red?


Well if you don't like red, with a 256-color terminal emulator you could change it into a nice shade of purple instead:

    static const char PURPLE[]     = "\x1b[38;5;129m"
    #define STDERR_COLOR PURPLE
Or something more sane: http://www.mudpedia.org/wiki/Xterm_256_colors


Not all of it, just stderr (so not stdout). This is useful because many things use stdout for regular output and stderr for error output (some things just use stdout for both, but that's not very nice as it disables doing things like this).


I think they're suggesting just styling "Error:" in red and then using normal text for the actual message.

npm does something like that: http://i.imgur.com/7oBLP.png


Well you can do that with a standard unix filter. This does all of stderr.


Whoops. I thought this was a tool for script authors, not the end user. Now I get it, and I think it's way cool. And I think J_Darnley doesn't like red.


To reply to everyone here, I still don't get why you want all text on stderr to be coloured, be it red or purple.

Most programs can write data to stdout so they put all messages on stderr. Making it all coloured hides the errors in the rest of the text.

Making errors red, or any other colour, is a good idea. It makes "under-experienced users" notice them.


I'm getting terribly confused by your confusion, so forgive me if I'm not addressing your concern..

If the program is mixing "info" level messages and "error" level messages (to use the syslog terms for them) on stderr, there really isn't much we can do about it. The understanding however is that things on stderr are probably things that the user wants to read.

Coloring both of these red shouldn't hide them anymore than coloring both of them white, except now they are both easily discernible from the 'data' coming out of stdout (which is our goal).

Possible aside: the proper way to write/read from the terminal in cases where your stdin/stdout were redirected is to just open up /dev/tty yourself. Any program that does that will not have that text colored by any of the solutions I've seen here.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: