[RFC] ColorD

Jens Mueller jens.k.mueller at gmx.de
Sun Oct 21 14:01:08 PDT 2012


Robik wrote:
> Hello,
> 
> I would like to introduce ColorD, small library that allows to
> simply manipulate console output colors, both on Windows and Posix
> operating systems. It also supports font styles such as underline
> and strikethrough(Posix feature only).
> 
> 
> Simple example:
> 
> import std.stdio, colord;
> void main()
> {
>     setConsoleColors(Fg.red, Bg.blue);
>     writeln("Red text on blue background.");
>     resetConsoleColors(); // Bring back initial state
> }
> 
> 
> Feedback welcome.
> 
> GitHub: https://github.com/robik/ColorD

Interesting looks solid to me.
Some nit-picks:
* Coloring on Posix depends a ANSI terminal. Can you check that a
  terminal is ANSI compatible?
* There are some magic numbers in the code. These may be difficult to
  figure out for maintaining.
* enum Color should maybe be same on all systems.
  This is a rather small issue. But I may transfer the Color to another
  system. So if it is possible there should only be one enum Color for
  all systems.
* Call it terminal or similar. Because other terminal related stuff can
  be added and IMHO it's a better name.

I have written a similar library. Not finished. Let's join forces.
https://github.com/jkm/terminal

Johannes Pfau has written a progress bar. I will add this.

Jens


More information about the Digitalmars-d mailing list