tartley / colorama

Simple cross-platform colored terminal text in Python
BSD 3-Clause "New" or "Revised" License
3.56k stars 253 forks source link

Color Not Outputting #297

Closed ghost closed 3 years ago

ghost commented 3 years ago

I don't get any color but instead something weird...

My Code:

from colorama import Fore, Back, Style
print(Fore.RED + 'some red text')
print(Back.GREEN + 'and with a green background')
print(Style.DIM + 'and in dim text')
print(Style.RESET_ALL)
print('back to normal now')

My output:

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
============== RESTART: C:\Users\talin\Desktop\Code\color-test.py ==============
some red text
and with a green background
and in dim text

back to normal now
>>> 

And just-in-case the output looks weird:

image

What is wrong?

I don't have any errors so colorama is installed right...

ownaginatious commented 3 years ago

I believe you need to do this on Windows to make the colors work:

from colorama import init

init()
ghost commented 3 years ago

I believe you need to do this on Windows to make the colors work:

from colorama import init

init()

Yes, I tried that and it didn't work... Then I copied & pasted your code and it did! I guess I was typing it wrong before!