icecream icon indicating copy to clipboard operation
icecream copied to clipboard

Cannot modify default colours

Open CHR-onicles opened this issue 3 years ago • 6 comments

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.

CHR-onicles avatar Jan 25 '21 23:01 CHR-onicles

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?

gruns avatar Jan 27 '21 23:01 gruns

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.

CHR-onicles avatar Jan 28 '21 16:01 CHR-onicles

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

silver-dragon avatar Apr 08 '21 21:04 silver-dragon

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

gruns avatar Aug 30 '21 22:08 gruns

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.

smprather avatar Jun 02 '22 17:06 smprather

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

https://github.com/gruns/icecream/pull/157

fanoway avatar Oct 07 '23 04:10 fanoway