1

I want to use ANSI escape codes to print colored text during Python program execution (in IDLE or CMD or another terminal). Please tell me the exact commands for Windows Command Prompt to enable VT100 terminal emulation or tell me another method step by step.

I have already searched and found some methods, but I didn't understand how to implement them. Please answer in a simple step by step format that I can follow.

aschultz
  • 1,658
  • 3
  • 20
  • 30
R.Bansal
  • 157
  • 1
  • 6
  • I would personally use the [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701#activetab=pivot:overviewtab), as it supports this stuff out of the box. – Unsigned_Arduino Oct 22 '20 at 02:58
  • I think you should ask this question in SuperUser (it is on topic on both sites, but I expect more answer there: here your question may be hidden because seldom used tags), and "step by step" mean you are not a programmer, so you may find easier answer there [here we assume programmes]. Personally I use the terminal provided by GIT (the "Git Bash"), and customized as required. [just install git from official source, and you get the terminal] – Giacomo Catenazzi Oct 22 '20 at 07:07
  • @GiacomoCatenazzi FYI I'm a Programmer. I was just exhausted with the search so I asked for step by step solution. A solution from a similar question asked worked for me. I used ansicon.exe file. Download this (https://github.com/adoxa/ansicon/releases) and just run ansicon.exe. Thank you for your reply. – R.Bansal Oct 22 '20 at 10:01

1 Answers1

2

This method worked for me, so maybe it will work for some of you, also.

Just download the latest ansicon.zip from this GitHub repo.

After that, unzip it and run ansicon.exe according to your processor type, and it's done.

Now you can display colored text in a Windows command prompt.

This solution was answered in another similar question, but I don't have its link now.

aschultz
  • 1,658
  • 3
  • 20
  • 30
R.Bansal
  • 157
  • 1
  • 6
  • https://stackoverflow.com/questions/16081639/how-to-use-vt100-code-in-windows has good instructions, and https://stackoverflow.com/questions/16755142/how-to-make-win32-console-recognize-ansi-vt100-escape-sequences mentions a registry change that works the next time you open a terminal. – aschultz Apr 28 '21 at 21:45