On 03/12/2012 10:37 PM, James Miller wrote:
I think the problem with putting it into formatting is that it is
inherently not output. IOW formatting should go anywhere, but colored
output is terminal-only.
Also, there are differences between terminals and all sorts of crap
that just make this harder to do "simply". However, there's no reason
why there cant be an easy way to colorize output in std.terminal (or
whatever), that are basically just modified writef(ln) calls
(colorWritef?) that only output to stdout (and maybe stderr). I think
this would be a good way around it, because then everything that is
terminal-specific is kept in one place, and you don't get mistakes
like outputting color to a file because you did the wrong sequence, or
forgot to check that stdout is a terminal and all that.
--
James Miller
I do want to be able to format things besides color with the color
formatting function. Maybe I can pick out the color format specifiers
first and then pass the rest to format. It'd be a shame to reimplement
format.
At that point it would be cool if thrown exceptions and the like could
do color formatting, and also know when to strip it out when writing to
log files and such. I don't know how difficult or practical it would
be, but I think that stack traces with color highlights would be
awesome. It's pretty in-your-face user experience-wise too; might be
good PR for D.
So then, now for the fun part. What to name this function?
zoosmellPooplord(ln)("%Cred(Text.%)");