How about colors and terminal graphics in std.format?

James Miller james at aatch.net
Mon Mar 12 22:41:01 PDT 2012


On 13 March 2012 18:24, Chad J <chadjoan at __spam.is.bad__gmail.com> wrote:
> I'm not sure I agree with resetting to a default color.  What if I want to
> write to the stream without altering the terminal's graphics settings?

Actually, I meant more to make sure that any output is reset to the
terminal's default. I'm pretty sure there is a way to do this. The
point is that not undoing mode changes is bad form.

Otherwise, I can live with the colourings being nested, but I would
suggest a change in syntax, I understand that yours is mostly just for
show, but using parenthesis will be annoying, I'd probably use braces
('{' and '}') instead, since they are less common.

writefln('%Cred(\(this is in color\))');
 vs
writefln('%Cred{(this is in color)}');

Neither are /that/ pretty, but at least the second one requires less
escaping in the common case.

--
James Miller


More information about the Digitalmars-d mailing list