[fpc-pascal] Printing terminal colors with writeln

geneb geneb at deltasoft.com
Thu Sep 26 22:45:54 CEST 2019

On Thu, 26 Sep 2019, Ryan Joseph wrote:

> In C I can do:
> // https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
> printf("\033[31;1;4mHello\033[0m");
> and get red text in the terminal (MacOS). When I do the same thing with 
> writeln and FPC it prints the literal characters with no colors. Why 
> doesn’t this work the same in FPC I wonder?

Because Pascal isn't C. :)

writeln(char(27) + '[31;1;4mHello' + char(27) + '[0m');

That might not work, but it's damn close to what would ;)


Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home.
Some people collect things for a hobby.  Geeks collect hobbies.

ScarletDME - The red hot Data Management Environment
A Multi-Value database for the masses, not the classes.
http://scarlet.deltasoft.com - Get it _today_!

More information about the fpc-pascal mailing list