From 30f87f962601c4fbecc3180baf9a12822fc30ed3 Mon Sep 17 00:00:00 2001 From: Lucas Colombo Date: Sun, 31 Mar 2024 01:29:14 -0300 Subject: [PATCH] =?UTF-8?q?refactor(cli):=20=F0=9F=94=A8=20/stylize:=20cha?= =?UTF-8?q?nge=20dimmed=20to=20"dim"=20everywhere?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/stylizer.rs | 2 +- lib/cli/stylize/style.rs | 4 ++-- lib/cli/stylize/stylizer.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/stylizer.rs b/examples/stylizer.rs index 0339c2f..49747a6 100644 --- a/examples/stylizer.rs +++ b/examples/stylizer.rs @@ -17,7 +17,7 @@ fn main() -> Result<()> { let red_on_blue = stylize("[white on blue]", "white on blue"); let rgb = stylize("[#3a95ef]", "#3a95ef"); let rgb_on_rgb = stylize("[#3a95ef on #c174dd]", "#3a95ef on #c174dd"); - let rgb_dim = stylize("[#3a95ef+dimmed]", "#3a95ef+dimmed"); + let rgb_dim = stylize("[#3a95ef+dim]", "#3a95ef+dim"); println!("pre {} post", red_bold); println!("pre {} post", alt_red_bold); diff --git a/lib/cli/stylize/style.rs b/lib/cli/stylize/style.rs index 493bf6b..00216d0 100644 --- a/lib/cli/stylize/style.rs +++ b/lib/cli/stylize/style.rs @@ -106,7 +106,7 @@ bitflags! { #[derive(Clone, PartialEq, Eq, Debug)] pub struct StyleAttributes: u8 { const BOLD = 0b00000001; - const DIMMED = 0b00000010; + const DIM = 0b00000010; const ITALIC = 0b00000100; const UNDERLINE = 0b00001000; const BLINK = 0b00010000; @@ -122,7 +122,7 @@ impl StyleAttributes { if self.contains(StyleAttributes::BOLD) { v.push("1"); } - if self.contains(StyleAttributes::DIMMED) { + if self.contains(StyleAttributes::DIM) { v.push("2"); } if self.contains(StyleAttributes::ITALIC) { diff --git a/lib/cli/stylize/stylizer.rs b/lib/cli/stylize/stylizer.rs index 0747fb3..1652aff 100644 --- a/lib/cli/stylize/stylizer.rs +++ b/lib/cli/stylize/stylizer.rs @@ -126,7 +126,7 @@ pub trait Stylize { fn on_bright_white(&self) -> String { self.stl("on bright-white") } fn on_rgb(&self, r: u8, g: u8, b: u8) -> String { self.stl(&format!("on #{:02X}{:02X}{:02X}", r, g, b)) } fn bold(&self) -> String { self.stl("+bold") } - fn dim(&self) -> String { self.stl("+dimmed") } + fn dim(&self) -> String { self.stl("+dim") } fn italic(&self) -> String { self.stl("+italic") } fn underline(&self) -> String { self.stl("+underline") } fn blink(&self) -> String { self.stl("+blink") }