From 4cb79c61f0b6f52940f4fb8f6256bd20a85a2dd9 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 27 Jun 2024 10:44:11 -0400 Subject: [PATCH] Improve instructions in README about getting ANSI colors working in windows terminals --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 79fe582..bf90c40 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,15 @@ Inside a terminal: pip install requests colorama termcolor ``` -In order to get ANSI colors in windows CMD or Powershell the virtual terminal level must be set to 1. -This is only needed **IF** : +By default the CMD and Powershell terminals will not properly show ANSI colors in Windows. This can be fixed by using the colorama module with the following code: +```python +import sys +if sys.platform == "win32": + from colorama import just_fix_windows_console + just_fix_windows_console() +``` -* You have administrator access on your PC -* And you can't use colorama for some reason +In order to get ANSI colors in windows CMD or Powershell without using the colorama module (can be useful in other things so if you do have admin access this is handy to do regardless) the virtual terminal level must be set to 1. Inside an **Administrator** terminal in the `PreReq/` folder: ```bash