You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if_support_color that accepts a boolean value and returns String. if_supports_color(&'a self, colored_output: bool, apply: ApplyFn). The idea is similar to set_override in owo_colors - Rust, but I I need something like if_support_color that return String.
Otherwise, I need to use if-else everywhere to check if the user wants the color colored_output.
use owo_colors::OwoColorize;fnmain(){let colored_output:bool = true;let is_formatted = if colored_output {// ⚠ ⚠format!("{} files formatted", 5).green().to_string()}else{format!("{} files formatted", 5)};let is_unchanged = format!("{} files unchanged", 10);let is_failed = if colored_output {// ⚠ ⚠format!("{} files failed to format", 4).red().to_string()}else{format!("{} files failed to format", 4)};let message = format!("{}. {}. {}", is_formatted, is_unchanged, is_failed);println!("{}", message.default_color());}
Or, do you have any better approach?
Thanks for owo-colors. ❤️
The text was updated successfully, but these errors were encountered:
Hi.
Is there any way to
clear
all the colored styles in the string?I tried default_color - OwoColorize in owo_colors , but no luck.
The color is still there
Do we have something like:
if_support_color
that accepts a boolean value and returnsString
. if_supports_color(&'a self, colored_output: bool, apply: ApplyFn). The idea is similar to set_override in owo_colors - Rust, but I I need something likeif_support_color
that returnString
.Otherwise, I need to use
if-else
everywhere to check if the user wants the colorcolored_output
.Or, do you have any better approach?
Thanks for owo-colors. ❤️
The text was updated successfully, but these errors were encountered: