jam1garner / owo-colors

A zero-allocation no_std-compatible zero-cost way to add color to your Rust terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get Effect from string?

azzamsa opened this issue · comments

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! ❤️

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?

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