Getting ANSI start and end sequence separated
dominikwilkowski opened this issue · comments
Is there a way to get the start and end ANSI sequence from owo_colors for a given rgb value (or any other parsed color I guess)?
I need it and before implementing a method to generate a color, split if and take each bit separately I thought I ask here.
In my mind it would be something like this:
println!("unstyled {} some styled text here {} unstyled",
OwoColorize.rgb(70, 130, 180).start,
OwoColorize.rgb(70, 130, 180).end
);
Or something like that?
For cases where the color is statically determined, ANSI_FG from the Color trait exists currently. There's also runtime versions in DynColor but they're not easy to use due to being intended for fmt trait impls, so waiting for the Style API for this is likely preferable
Closing, @dominikwilkowski, as it should be included in #55. See https://docs.rs/owo-colors/latest/owo_colors/struct.Style.html#method.fmt_prefix