From fb500dedfc9531b4fc32c7f4a46ed9c193f9cceb Mon Sep 17 00:00:00 2001 From: tiberiugila Date: Sat, 20 Jan 2024 22:50:17 +0200 Subject: [PATCH 1/3] Fixed https://github.com/console-rs/console/issues/177 --- .idea/.gitignore | 8 +++ .idea/console.iml | 14 +++++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 +++ src/utils.rs | 130 ++++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/console.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/console.iml b/.idea/console.iml new file mode 100644 index 00000000..768e4007 --- /dev/null +++ b/.idea/console.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..ef1bfd5d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/utils.rs b/src/utils.rs index cfecc78f..f1cb598c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -84,6 +84,14 @@ pub enum Color { Blue, Magenta, Cyan, + Silver, + Grey, + Maroon, + Lime, + Fuchsia, + Navy, + Aqua, + Olive, White, Color256(u8), } @@ -95,11 +103,19 @@ impl Color { Color::Black => 0, Color::Red => 1, Color::Green => 2, - Color::Yellow => 3, - Color::Blue => 4, + Color::Yellow => 11, + Color::Blue => 12, Color::Magenta => 5, Color::Cyan => 6, - Color::White => 7, + Color::Silver => 7, + Color::Grey => 8, + Color::Maroon => 9, + Color::Lime => 10, + Color::Fuchsia => 13, + Color::Navy => 4, + Color::Olive => 3, + Color::Aqua => 14, + Color::White => 15, Color::Color256(x) => x as usize, } } @@ -203,6 +219,14 @@ impl Style { "blue" => rv.blue(), "magenta" => rv.magenta(), "cyan" => rv.cyan(), + "silver" => rv.silver(), + "aqua" => rv.aqua(), + "grey" => rv.grey(), + "maroon" => rv.maroon(), + "lime" => rv.lime(), + "fuchsia" => rv.fuchsia(), + "navy" => rv.navy(), + "olive" => rv.olive(), "white" => rv.white(), "bright" => rv.bright(), "on_black" => rv.on_black(), @@ -212,6 +236,14 @@ impl Style { "on_blue" => rv.on_blue(), "on_magenta" => rv.on_magenta(), "on_cyan" => rv.on_cyan(), + "on_silver" => rv.on_silver(), + "on_grey" => rv.on_grey(), + "on_maroon" => rv.on_maroon(), + "on_lime" => rv.on_lime(), + "on_fuchsia" => rv.on_fuchsia(), + "on_navy" => rv.on_navy(), + "on_olive" => rv.on_olive(), + "on_aqua" => rv.on_aqua(), "on_white" => rv.on_white(), "on_bright" => rv.on_bright(), "bold" => rv.bold(), @@ -324,6 +356,38 @@ impl Style { self.fg(Color::Cyan) } #[inline] + pub fn aqua(self) -> Style { + self.fg(Color::Aqua) + } + #[inline] + pub fn silver(self) -> Style { + self.fg(Color::Silver) + } + #[inline] + pub fn grey(self) -> Style { + self.fg(Color::Grey) + } + #[inline] + pub fn maroon(self) -> Style { + self.fg(Color::Maroon) + } + #[inline] + pub fn lime(self) -> Style { + self.fg(Color::Lime) + } + #[inline] + pub fn fuchsia(self) -> Style { + self.fg(Color::Fuchsia) + } + #[inline] + pub fn navy(self) -> Style { + self.fg(Color::Navy) + } + #[inline] + pub fn olive(self) -> Style { + self.fg(Color::Olive) + } + #[inline] pub fn white(self) -> Style { self.fg(Color::White) } @@ -367,6 +431,38 @@ impl Style { self.bg(Color::Cyan) } #[inline] + pub fn on_aqua(self) -> Style { + self.bg(Color::Aqua) + } + #[inline] + pub fn on_silver(self) -> Style { + self.bg(Color::Silver) + } + #[inline] + pub fn on_grey(self) -> Style { + self.bg(Color::Grey) + } + #[inline] + pub fn on_maroon(self) -> Style { + self.bg(Color::Maroon) + } + #[inline] + pub fn on_lime(self) -> Style { + self.bg(Color::Lime) + } + #[inline] + pub fn on_fuchsia(self) -> Style { + self.bg(Color::Fuchsia) + } + #[inline] + pub fn on_navy(self) -> Style { + self.bg(Color::Navy) + } + #[inline] + pub fn on_olive(self) -> Style { + self.bg(Color::Olive) + } + #[inline] pub fn on_white(self) -> Style { self.bg(Color::White) } @@ -565,6 +661,34 @@ impl StyledObject { self.bg(Color::Cyan) } #[inline] + pub fn on_silver(self) -> StyledObject { + self.bg(Color::Silver) + } + #[inline] + pub fn on_grey(self) -> StyledObject { + self.bg(Color::Grey) + } + #[inline] + pub fn on_maroon(self) -> StyledObject { + self.bg(Color::Maroon) + } + #[inline] + pub fn on_lime(self) -> StyledObject { + self.bg(Color::Lime) + } + #[inline] + pub fn on_fuchsia(self) -> StyledObject { + self.bg(Color::Fuchsia) + } + #[inline] + pub fn on_navy(self) -> StyledObject { + self.bg(Color::Navy) + } + #[inline] + pub fn on_olive(self) -> StyledObject { + self.bg(Color::Olive) + } + #[inline] pub fn on_white(self) -> StyledObject { self.bg(Color::White) } From fca5de9e4f57b397f0bd62b67d6fa58b7793bf19 Mon Sep 17 00:00:00 2001 From: Gila Tiberiu Florin <118210644+tiberiugila@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:50:17 +0200 Subject: [PATCH 2/3] Deleted the .idea folder --- .idea/.gitignore | 8 -------- .idea/console.iml | 14 -------------- .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ 4 files changed, 36 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/console.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/console.iml b/.idea/console.iml deleted file mode 100644 index 768e4007..00000000 --- a/.idea/console.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index ef1bfd5d..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 7d0d3ffb9d679260fa1ed6838cc133700a4458d7 Mon Sep 17 00:00:00 2001 From: Gila Tiberiu Florin <118210644+tiberiugila@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:10:34 +0000 Subject: [PATCH 3/3] Added BrightWhite and reverted White --- src/utils.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index f1cb598c..aa191d11 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -84,7 +84,7 @@ pub enum Color { Blue, Magenta, Cyan, - Silver, + White, Grey, Maroon, Lime, @@ -92,7 +92,7 @@ pub enum Color { Navy, Aqua, Olive, - White, + BrightWhite, Color256(u8), } @@ -107,7 +107,7 @@ impl Color { Color::Blue => 12, Color::Magenta => 5, Color::Cyan => 6, - Color::Silver => 7, + Color::White => 7, Color::Grey => 8, Color::Maroon => 9, Color::Lime => 10, @@ -115,7 +115,7 @@ impl Color { Color::Navy => 4, Color::Olive => 3, Color::Aqua => 14, - Color::White => 15, + Color::BrightWhite => 15, Color::Color256(x) => x as usize, } } @@ -219,7 +219,7 @@ impl Style { "blue" => rv.blue(), "magenta" => rv.magenta(), "cyan" => rv.cyan(), - "silver" => rv.silver(), + "white" => rv.white(), "aqua" => rv.aqua(), "grey" => rv.grey(), "maroon" => rv.maroon(), @@ -227,7 +227,7 @@ impl Style { "fuchsia" => rv.fuchsia(), "navy" => rv.navy(), "olive" => rv.olive(), - "white" => rv.white(), + "brightwhite" => rv.brightwhite(), "bright" => rv.bright(), "on_black" => rv.on_black(), "on_red" => rv.on_red(), @@ -236,7 +236,7 @@ impl Style { "on_blue" => rv.on_blue(), "on_magenta" => rv.on_magenta(), "on_cyan" => rv.on_cyan(), - "on_silver" => rv.on_silver(), + "on_white" => rv.on_white(), "on_grey" => rv.on_grey(), "on_maroon" => rv.on_maroon(), "on_lime" => rv.on_lime(), @@ -244,7 +244,7 @@ impl Style { "on_navy" => rv.on_navy(), "on_olive" => rv.on_olive(), "on_aqua" => rv.on_aqua(), - "on_white" => rv.on_white(), + "on_brightwhite" => rv.on_brightwhite(), "on_bright" => rv.on_bright(), "bold" => rv.bold(), "dim" => rv.dim(), @@ -360,8 +360,8 @@ impl Style { self.fg(Color::Aqua) } #[inline] - pub fn silver(self) -> Style { - self.fg(Color::Silver) + pub fn brightwhite(self) -> Style { + self.fg(Color::BrightWhite) } #[inline] pub fn grey(self) -> Style { @@ -435,8 +435,8 @@ impl Style { self.bg(Color::Aqua) } #[inline] - pub fn on_silver(self) -> Style { - self.bg(Color::Silver) + pub fn on_brightwhite(self) -> Style { + self.bg(Color::BrightWhite) } #[inline] pub fn on_grey(self) -> Style { @@ -661,8 +661,8 @@ impl StyledObject { self.bg(Color::Cyan) } #[inline] - pub fn on_silver(self) -> StyledObject { - self.bg(Color::Silver) + pub fn on_brightwhite(self) -> StyledObject { + self.bg(Color::BrightWhite) } #[inline] pub fn on_grey(self) -> StyledObject {