refactor: colored text

This commit is contained in:
rzmk 2025-09-03 08:34:53 -04:00
parent fe656fc242
commit 572cfab8ca
2 changed files with 61 additions and 68 deletions

29
src/styles.rs Normal file
View file

@ -0,0 +1,29 @@
use owo_colors::{OwoColorize, Stream::Stdout};
pub fn highlighted_text(text: &str) -> impl std::fmt::Display {
format!(
"{}",
text.if_supports_color(Stdout, |t| t.on_blue().white())
)
}
pub fn important_text(text: &str) -> impl std::fmt::Display {
format!(
"{}",
text.if_supports_color(Stdout, |t| t.on_bright_red().white())
)
}
pub fn step_text(text: &str) -> impl std::fmt::Display {
format!(
"{}",
text.if_supports_color(Stdout, |t| t.on_magenta().white())
)
}
pub fn success_text(text: &str) -> impl std::fmt::Display {
format!(
"{}",
text.if_supports_color(Stdout, |t| t.on_green().white())
)
}