[ENH] - allow to control colors in terminal
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
Yellow is the most problematic, but I'd prefer to just have --color=no. Because you never know what terminal config someone uses.
Thanks for raising this with us @nkaretnikov! This is definitely something that will need to be sorted out.
seems like in the code there are various places where either rich.print or console is used.
Id suggest
- find all the
rich.printreplace them with a correspondingconsole.print - when we pass in
--color=nowell just set allconsole.no_color = True - additionally we have to figure out where and what each rich/console s are used for
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:
- 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?
- There is no way to pass a
rich.consoleto thetyper.Typerconstructor. Uncertain whether access to the typer console instance is accessible either. - It may be possible to modify this with env variables with specific Themes just like
typer/rich_utils.pydoes is the way to do it (STYLE_OPTION_ENVVAR) but it does seem that_get_rich_consoleseems to be instantiating a new console Theme all the time when the typer command gets rendered out.