nebari-dev / nebari

🪴 Nebari - your open source data science platform
https://nebari.dev
BSD 3-Clause "New" or "Revised" License
279 stars 92 forks source link

[ENH] - allow to control colors in terminal #2023

Open nkaretnikov opened 1 year ago

nkaretnikov commented 1 year ago

Feature description

This is unreadable in a terminal with white background:

nebari init --help      

Provide an option to disable colors.

Some popular terminal configurations to test: ubuntu terminal, dark bg, white bg, solarized.

Value and/or benefit

See above.

Anything else?

6d01b048dd01e884d3a9f1d60ddebd4dbe96432e

nkaretnikov commented 1 year ago

Yellow is the most problematic, but I'd prefer to just have --color=no. Because you never know what terminal config someone uses.

Screen Shot 2023-09-22 at 09 18 00
iameskild commented 1 year ago

Thanks for raising this with us @nkaretnikov! This is definitely something that will need to be sorted out.

abdulazizali77 commented 5 months ago

seems like in the code there are various places where either rich.print or console is used. Id suggest

And then as a followup activity, we have to take out the direct color references eg [green][/green] and replace them with style themes/semantic tags eg [uri][/uri] as mentioned in #1478 . As in well leave those embedded stylings as is for now

@nkaretnikov @iameskild what do you guys think?

Edit:

  1. This is easiest to just set NO_COLOR env variable and rich will disable all color. (not Typer). Not ideal but seems to be the only way?
  2. There is no way to pass a rich.console to the typer.Typer constructor. Uncertain whether access to the typer console instance is accessible either.
  3. It may be possible to modify this with env variables with specific Themes just like typer/rich_utils.py does is the way to do it (STYLE_OPTION_ENVVAR) but it does seem that _get_rich_console seems to be instantiating a new console Theme all the time when the typer command gets rendered out.