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

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

Open
Tracked by #1478
nkaretnikov opened this issue Sep 22, 2023 · 3 comments
Open
Tracked by #1478

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

nkaretnikov opened this issue Sep 22, 2023 · 3 comments

Comments

@nkaretnikov
Copy link

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?

6d01b04

@nkaretnikov
Copy link
Author

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 iameskild added area: user experience 👩🏻‍💻 needs: investigation 🔍 Someone in the team needs to find the root cause and replicate this bug labels Sep 25, 2023
@pavithraes pavithraes added the type: enhancement 💅🏼 New feature or request label Sep 25, 2023
@pavithraes pavithraes added good first issue Good for newcomers and removed needs: investigation 🔍 Someone in the team needs to find the root cause and replicate this bug labels Oct 9, 2023
@iameskild
Copy link
Member

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

@abdulazizali77
Copy link

abdulazizali77 commented Jun 9, 2024

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

  • find all the rich.print replace them with a corresponding console.print
  • when we pass in --color=no well just set all console.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:

  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New 🚦
Development

No branches or pull requests

4 participants