-
-
Notifications
You must be signed in to change notification settings - Fork 770
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
termwiz: support NO_COLOR environment variable #5020
Conversation
Hi! Thanks for this! It's a very targeted implementation and it isn't the way I would have thought to do it, which I'll describe below. What I had in mind when I read the summary of this PR is definitely more work than your proposed implementation, but I think it is probably better in the long term for a couple of reasons:
termwiz has a Capabilities concept that is intended to communicate a combination of terminal capabilities and user preferences down to the underlying rendering layer. In terms of color, there is a
wezterm/termwiz/src/caps/mod.rs Lines 122 to 126 in 22f9f8d
so I would imagine that the implementation of this feature might be:
wezterm/termwiz/src/render/terminfo.rs Line 52 in 22f9f8d
wezterm/termwiz/src/render/windows.rs Lines 72 to 88 in 22f9f8d
What do you think of this? |
Hey @wez, thank you for your detailed response (and sorry for the late reply!) The proposed solution makes sense to me and definitely sounds better for the long term. I will update the implementation based on this and let you know if there are any rough edges. |
Hey again @wez I made the suggested changes and it works as expected on Linux. I didn't have the chance to test Windows though. Let me know! |
ff1d479
to
ceeea5d
Compare
LGTM, thanks! |
* termwiz: support NO_COLOR environment variable * style: update formatting * refactor: use capabilities for enabling no-color
Hey!
I'm one of the maintainers of @ratatui-org and we had one issue where we discussed supporting the
NO_COLOR
environment variable: ratatui/ratatui#884We support
termwiz
as one of our backends and I realized it does not supportNO_COLOR
environment variable which brought me here.I'm pretty sure you are familiar with it but here is more information about no color: https://no-color.org
One example use case is:
In this PR, I give this a quick stab (based on crossterm's implementation) and you can see this taking effect in our
termwiz
example:I'm happy to make changes in the implementation (and also add tests) - just let me know! 🐻