Author Topic: Colored text in console?  (Read 302 times)


  • New Member
  • *
  • Posts: 23
Colored text in console?
« on: January 28, 2021, 09:23:03 am »
I know that i can use the CRT unit. But it implements its own display driver and i don't really like that. How can i get colored text in the console on linux without having to use the CRT unit. I know in c/c++ you use some thing like this:

Code: C  [Select][+][-]
  1. printf("\033[1;31mbold red text\033[0m\n");

Will this also work with freepascal?


  • Hero Member
  • *****
  • Posts: 2900
  • Compiler Developer
Re: Colored text in console?
« Reply #1 on: January 28, 2021, 09:33:20 am »
As long as your console understands these sequences, then you can do the same:

Code: Pascal  [Select][+][-]
  1. Writeln(#&33'[1;31mbold red text'#&33'[0m');

Alternatively there is the LazTermUtils unit by Warfley.


TinyPortal © 2005-2018