[fpc-pascal] Printing terminal colors with writeln

Jonas Maebe jonas at freepascal.org
Thu Sep 26 22:46:38 CEST 2019

On 26/09/2019 22:41, 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?

In C, \033 inside a string means "the ASCII character with octal value
033". In Pascal, \033 instead a string means "\033". Use this instead:


More information about the fpc-pascal mailing list