Updated colors
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
27243ee449
commit
f4b957a0b2
|
@ -2,25 +2,27 @@ extern crate termion;
|
|||
|
||||
use termion::color;
|
||||
|
||||
const COLOR_RESET: color::Fg<color::Reset> = color::Fg(color::Reset);
|
||||
const COLOR_SYMBOLS: color::Fg<color::LightGreen> = color::Fg(color::LightGreen);
|
||||
const COLOR_TEXT: color::Fg<color::Cyan> = color::Fg(color::Cyan);
|
||||
const COLOR_NUMBERS: color::Fg<color::LightBlue> = color::Fg(color::LightBlue);
|
||||
const COLOR_OTHER: color::Fg<color::Yellow> = color::Fg(color::Yellow);
|
||||
|
||||
pub fn map_u8_to_color(data: u8) -> String {
|
||||
if super::isatty() {
|
||||
match data {
|
||||
32..=47 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, color::Fg(color::Reset)),
|
||||
48..=57 => format!("{}{:02x}{}", COLOR_NUMBERS, data, color::Fg(color::Reset)),
|
||||
58..=64 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, color::Fg(color::Reset)),
|
||||
65..=90 => format!("{}{:02x}{}", COLOR_TEXT, data, color::Fg(color::Reset)),
|
||||
91..=96 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, color::Fg(color::Reset)),
|
||||
97..=122 => format!("{}{:02x}{}", COLOR_TEXT, data, color::Fg(color::Reset)),
|
||||
123..=126 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, color::Fg(color::Reset)),
|
||||
32..=47 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, COLOR_RESET),
|
||||
48..=57 => format!("{}{:02x}{}", COLOR_NUMBERS, data, COLOR_RESET),
|
||||
58..=64 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, COLOR_RESET),
|
||||
65..=90 => format!("{}{:02x}{}", COLOR_TEXT, data, COLOR_RESET),
|
||||
91..=96 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, COLOR_RESET),
|
||||
97..=122 => format!("{}{:02x}{}", COLOR_TEXT, data, COLOR_RESET),
|
||||
123..=126 => format!("{}{:02x}{}", COLOR_SYMBOLS, data, COLOR_RESET),
|
||||
_ => format!(
|
||||
"{}{:02x}{}",
|
||||
color::Fg(color::LightBlack),
|
||||
COLOR_OTHER,
|
||||
data,
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
}
|
||||
} else {
|
||||
|
@ -35,48 +37,48 @@ pub fn map_char_to_color(data: u8) -> String {
|
|||
"{}{}{}",
|
||||
COLOR_SYMBOLS,
|
||||
(data as char),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
48..=57 => format!(
|
||||
"{}{}{}",
|
||||
COLOR_NUMBERS,
|
||||
(data as char),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
58..=64 => format!(
|
||||
"{}{}{}",
|
||||
COLOR_SYMBOLS,
|
||||
(data as char),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
65..=90 => format!(
|
||||
"{}{}{}",
|
||||
COLOR_TEXT,
|
||||
(data as char),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
91..=96 => format!(
|
||||
"{}{}{}",
|
||||
COLOR_SYMBOLS,
|
||||
(data as char),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
97..=122 => format!(
|
||||
"{}{}{}",
|
||||
COLOR_TEXT,
|
||||
(data as char),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
123..=126 => format!(
|
||||
"{}{}{}",
|
||||
COLOR_SYMBOLS,
|
||||
(data as char),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_RESET
|
||||
),
|
||||
_ => format!(
|
||||
"{}.{}",
|
||||
color::Fg(color::LightBlack),
|
||||
color::Fg(color::Reset)
|
||||
COLOR_SYMBOLS,
|
||||
COLOR_RESET
|
||||
),
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue