Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot modify default colours #52

Open
CHR-onicles opened this issue Jan 25, 2021 · 6 comments
Open

Cannot modify default colours #52

CHR-onicles opened this issue Jan 25, 2021 · 6 comments

Comments

@CHR-onicles
Copy link

Hi,
I tried changing the default colours in coloring.py specifically, BASE0 and BASE03 after cloning the repo and running pip install -e ./ in the directory with setup.py as stated here, to install my edited version in developer mode. But it seems this has no effect at all even after many tries and restarting both IDE(Pycharm v2020.3, python 3.8.5) and computer(win10). I don't know if I'm missing something here.

I've been using icecream for a while but the default colours make it difficult for me to make out text in dark mode with Pycharm and I specifically want to change the normal text and whitespace colours since those affect me the most. Thanks.

@gruns
Copy link
Owner

gruns commented Jan 27, 2021

huh. I cant reproduce on linux

with BASE0 = '#839496': http://i.imgur.com/IpM1IG8.png

with BASE0 = '#ff0000': http://i.imgur.com/COWaZvk.png

this appears related to windows. my guess is the problem lies with translation of ANSI escape character sequences by colorama (https://github.com/tartley/colorama) (the ANSI escape codes are inserted by pygments, https://github.com/pygments/pygments)

I dont have a windows machine to test on. can you dig further and verify if it is indeed colorama that is failing to translate the ANSI escape codes properly on windows somehow?

@CHR-onicles
Copy link
Author

CHR-onicles commented Jan 28, 2021

I don't really know much about colorama but I read some documentation and executed the sample tests they provided and they seem to both work well in Pycharm's terminal and on Win10's cmd.

This is what I get in Pycharm: https://imgur.com/a/nkxtdyJ
And from regular terminal: https://imgur.com/a/bclOnLf

When there's a lot of statements, makes it hard for me look for key stuff and its still the same output even after changing BASE0 = '#ff0000'. I just tested it out with the current version of icecream v2.1.0 by the way.

Edit: added screenshot of ic in terminal.

@silver-dragon
Copy link

I am experiencing similar issues also on windows. Both on VSCode terminal and Windows Terminal.

A dark background obscures the text and makes it impossible to read.

image

image

@gruns
Copy link
Owner

gruns commented Aug 30, 2021

for future intrepid explorers of this ticket, as a workaround until this issue is resolved you can disable coloring by setting the outputFunction to just print to stderr print(..., file=sys.stderr)

import sys
from icecream import ic

ic.configureOutput(outputFunction=lambda *a: print(*a, file=sys.stderr))

this bypasses icecream's coloring functionality

@smprather
Copy link

I'm here with the same problem using Win10 /Windows Terminal /PS Shell. The ic background comes out gray and is very hard to read. The above workaround does work. But the ic coloring is really nice to easily distinguish ic output vs. other output text. A real fix is not a high-prio, but would definitely be nice.

@fanoway
Copy link

fanoway commented Oct 7, 2023

I created a PR to add an disableColoring and enableColoring method to handle this.

#157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants