On Monday, 12 March 2012 at 03:32:26 UTC, Chad J wrote:
On 03/11/2012 11:27 PM, Damian Ziemba wrote:
On Monday, 12 March 2012 at 02:52:15 UTC, Andrei Alexandrescu
wrote:
On 3/11/12 9:16 PM, Chad J wrote:
I remember doing colored terminal output in Python. It was
pretty nifty,
and allows for some slick CLI design. I think D can do
better by putting
it in the standard library.
...
So, would this sort of thing make it in?
I don't know, seems interesting but I wonder how portable
that could
be. Probably I'd define a more general means a la %q to mean
"send a
control sequence" and then would define control sequences as
functions
or constants.
...
Andrei
It could work.
In my small framework I use version blocks and I use ansi
escape
sequences for posix and SetConsoleTextAttribute for windoze.
Ofcourse there would be a need to create unified enumeration
with colors
as they differ on those platforms too.
Good catch.
public enum Font
{
Normal = 0,
Underline = 0x8000,
Reverse = 0x4000,
}
public enum Color
{
Default = 0x0000,
Blue = 0x0001,
Green = 0x0002,
Aqua = 0x0003,
Red = 0x0004,
Purple= 0x0005,
Yellow= 0x0006,
Gray = 0x0008,
LightBlue = 0x0009,
LightGreen = 0x000A,
LightAqua = 0x000B,
LightRed = 0x000C,
LightPurple= 0x000D,
}
Those are colors and font-attributes that I found to match
both Windows
and Posix
If you can show me you're work and it's licensed in a way that
I can use it in Phobos, then I'll happily try to make use of
it. It'd be much appreciated.
Hey Chad.
Sorry for delay, been a bit busy.
Here it is: https://gist.github.com/2025473
I hope it can help you somehow.
(There is place for improvments I know but I used it mostly for
debbuging stuff ;))
And yea, I think like others that it should have its own module
like std.terminal/std.console or maybe somekind of spot in
std.stdio.
Best Regards,
Damian Ziemba