help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] ANSI Escape Codes


From: Ryland Taylor-Almanza
Subject: [Help-smalltalk] ANSI Escape Codes
Date: Mon, 7 Jul 2014 17:50:18 -0700

I'm trying to make a console-based program that makes use of ANSI
escape codes. I can't seem to figure out how to go about printing a
string object formatted with ANSI escape codes. I've tried the
following.

'\x1b[31mHi' displayNl

This prints the entire string, including the escape code, without any
formatting. I would have expected this to print "Hi" in red (and then
everything else in the console after that, as I didn't include the
escape code to reset the color.)

After googling a bit, I was able to find a couple issues where people
were trying to produce things like newlines using "\n". Most of the
answers were using the Transcript object's cr method, but I didn't
find anything about colors in the textCollector class.

It looks like it shouldn't be all that hard to create my own module in
C to achieve this functionality, but I'd like to know if there's a
better way first.

I'm aware of the ncurses bindings, but I'm not sure that'd be
practical for just making certain pieces of text in the program
colored. So, is there a standard way of outputting colored text to the
terminal in GNU Smalltalk using ANSI escape sequences?

Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]