import-linter icon indicating copy to clipboard operation
import-linter copied to clipboard

White text in output is invisible

Open Tapeline opened this issue 6 months ago • 1 comments

When using a light theme in terminal, the white text is invisible:

Image

I suggest removing unnecessary text coloring, that way in black terminal it will already be white by default, but also white terminal will be usable.

If you agree with the proposed change, I can create a PR.

Tapeline avatar Jun 14 '25 14:06 Tapeline

Oh yes agreed, yes please to a pr!

seddonym avatar Jun 14 '25 17:06 seddonym

I've done some investigation. Turns out that the issue is deeper, than I thought initially.

First, it seems to bee present only on Windows. Second, it's actually an issue with click's ~~style~~ echo function implementation. I didn't find another way to circumvent it, other than setting bold font manually:

print(f"\033[1m{text}\033[0m")
# upd. or using:
print(click.style(text, bold=True))

This way it works fine.

How we should address this?

Tapeline avatar Jun 25 '25 12:06 Tapeline

I have opened an issue at click's repo: pallets/click#2985

Tapeline avatar Jun 25 '25 12:06 Tapeline

Seems that we won't be getting a fix from click soon. They've scheduled colorama removal, but that will happen only at click 9.0.0. (see pallets/click#2986).

We have two options now:

  1. just sit and wait for click 9.0.0 to release, which will automatically solve the problem (will take about half a year);
  2. still wait for click 9.0.0, but for now, make a little patch to the ClickPrinter: use print(click.style()) instead of click.secho(). This, however, requires testing on various platforms and terminals to ensure that everything will work as expected.

What do you think?

Tapeline avatar Jul 08 '25 19:07 Tapeline

Option 2. sounds like a reasonable workaround, if you feel like making a PR. I am fairly relaxed about testing. I tried it locally on my Mac and things worked as expected.

A third option would be to provide a command line argument to lint-imports for disabling styling and color.

What do you think is best?

seddonym avatar Jul 09 '25 15:07 seddonym

A third option would be to provide a command line argument to lint-imports for disabling styling and color.

I don't think it'll be very convenient to use. In the end, this bug can be countered by simply highlighting text in terminal. My opinion is that typing a flag like --nocolor is easier and more convenient, than pressing Ctrl+A to see the text)

Option 2. sounds like a reasonable workaround, if you feel like making a PR.

Yeah, I'll create a PR soon.

Tapeline avatar Jul 09 '25 16:07 Tapeline