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

Add a feature flag to automate Windows coloring #25

Closed
SergioBenitez opened this issue Jun 13, 2021 · 6 comments
Closed

Add a feature flag to automate Windows coloring #25

SergioBenitez opened this issue Jun 13, 2021 · 6 comments

Comments

@SergioBenitez
Copy link
Owner

Basically, do the following automatically:

if !Paint::enable_windows_ascii() {
    Paint::disable()
}

The implementation should just check if painting is disabled via the already relaxed atomic bool and otherwise check a second atomic bool, also relaxes, to see if we've tried to enable Windows coloring already.

@epage
Copy link

epage commented Jun 14, 2021

imo yansi should do all or nothing. I appreciate that its (mostly) not doing things behind my back. The reason I was interested in yansi compared to termcolor (besides ergonomics) is termcolor half-implements the policy I need and implementing the rest felt like I was working against it rather than with it.

@SergioBenitez
Copy link
Owner Author

I think this is a rather special case. I don't want to care about the platform. Right now, I need to care about the platform. I cannot think of a single case where you would not want to write:

if !Paint::enable_windows_ascii() {
    Paint::disable()
}

I appreciate that its (mostly) not doing things behind my back. The

What do you feel it does behind your back?

@epage
Copy link

epage commented Jun 14, 2021

What do you feel it does behind your back?

@SergioBenitez
Copy link
Owner Author

SergioBenitez commented Jun 15, 2021

These are fantastic points, @epage! I'll think about this a bit. Perhaps we simply want to try enabling coloring on Windows without disabling them if it doesn't work. Thus, a Paint::disable() always disables, but by default, you get colors on Windows without doing anything. What do you think?

@epage
Copy link

epage commented Aug 4, 2021

Tired of copy/pasting my herding of cats (all of the color use in my applications), I've done some research on where Rust is at wrt to color and have created a prototype with a PoC conversion of termcolor (since it has the most varied use cases). I'd be interested in any feedback on the idea or design!

@SergioBenitez
Copy link
Owner Author

SergioBenitez commented Jun 15, 2023

v2 (in progress, see v2 branch) automatically enables support on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants