www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - dcaflib

reply "Nathan M. Swan" <nathanmswan gmail.com> writes:
In a post from a few weeks ago, someone mentioned terminal 
colors. Currently, I have one that works with bash (cmd pending) 
at https://github.com/carlor/dcaflib.

Example code:

import dcaflib.ui.terminal;

import std.stdio;

void main() {
     fgColor = TermColor.RED;
     writeln("this is red!");
     fgColor = TermColor.BLUE;
     writeln("this is blue!");
}
Mar 16 2012
next sibling parent "Joel Christensen" <joelcnz gmail.com> writes:
On Saturday, 17 March 2012 at 03:00:36 UTC, Nathan M. Swan wrote:
 In a post from a few weeks ago, someone mentioned terminal 
 colors. Currently, I have one that works with bash (cmd 
 pending) at https://github.com/carlor/dcaflib.

 Example code:

 import dcaflib.ui.terminal;

 import std.stdio;

 void main() {
     fgColor = TermColor.RED;
     writeln("this is red!");
     fgColor = TermColor.BLUE;
     writeln("this is blue!");
 }
This worked for me with Ubuntu. Though I had to use rdmd instead of dmd. I'm using a version like this for Windows for one of my programs. I've found with unix OS's you can't edit text very nice at all using readln(); etc. Windows doesn't have that problem. I don't even bother with stuff because of it. -Joel
Mar 18 2012
prev sibling parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
Nathan M. Swan wrote:

 In a post from a few weeks ago, someone mentioned terminal
 colors. Currently, I have one that works with bash (cmd pending)
 at https://github.com/carlor/dcaflib.
 
 Example code:
 
 import dcaflib.ui.terminal;
 
 import std.stdio;
 
 void main() {
      fgColor = TermColor.RED;
      writeln("this is red!");
      fgColor = TermColor.BLUE;
      writeln("this is blue!");
 }
Nathan, what terminals are supported? Only ANSI / VT* or some other types of terminals as well?
Mar 26 2012
parent "Nathan M. Swan" <nathanmswan gmail.com> writes:
On Monday, 26 March 2012 at 13:56:46 UTC, Dejan Lekic wrote:
 Nathan, what terminals are supported? Only ANSI / VT* or some 
 other types of
 terminals as well?
I've only tested it on OSX Terminal, but I read about the features on a Linux website, and have used the "ANSI escape code" Wikipedia article as reference, so I assume it's ANSI. NMS
Mar 26 2012