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

How to get Effect from string? #108

Open
azzamsa opened this issue Jun 21, 2023 · 2 comments
Open

How to get Effect from string? #108

azzamsa opened this issue Jun 21, 2023 · 2 comments

Comments

@azzamsa
Copy link

azzamsa commented Jun 21, 2023

Hi.

I am having a hard time finding the Effect::from(&str) or Style::from(&str). Are they don't exist?
On the contrary, I can use AnsiColors::from(style.as_str())) to get color from a string.

Thanks! ❤️

@azzamsa
Copy link
Author

azzamsa commented Jun 23, 2023

If I would make a PR?

What struct do I need to implement (impl) similar code to https://docs.rs/owo-colors/latest/src/owo_colors/dyn_colors.rs.html#74-112?

@jam1garner
Copy link
Owner

I don't think such a thing would be a very good API--if I pass Effect::from("blue") does this give blue foreground? blue background? if more complex formatting is added to disambiguate it becomes harder to parse and just generally kinda off-putting (imo). Would be interested in hearing what sort of behavior you'd be looking for

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

No branches or pull requests

2 participants