mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Replace colors with ANSI styles
This commit is contained in:
1 parent
a49f295acc
commit
98ceec18cd
1 file changed
+8
-9
+8
-9
@@ -4,15 +4,14 @@ pub use input::*;
|
|||||||
|
|
||||||
use std::io::{self, BufReader, Read, Write};
|
use std::io::{self, BufReader, Read, Write};
|
||||||
|
|
||||||
use ansi_term::Color;
|
use anstyle::{AnsiColor, Color, Style};
|
||||||
use ansi_term::Color::Fixed;
|
|
||||||
|
|
||||||
const COLOR_NULL: Color = Fixed(242); // grey
|
const COLOR_NULL: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::BrightBlack)));
|
||||||
const COLOR_OFFSET: Color = Fixed(242); // grey
|
const COLOR_OFFSET: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::BrightBlack)));
|
||||||
const COLOR_ASCII_PRINTABLE: Color = Color::Cyan;
|
const COLOR_ASCII_PRINTABLE: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan)));
|
||||||
const COLOR_ASCII_WHITESPACE: Color = Color::Green;
|
const COLOR_ASCII_WHITESPACE: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));
|
||||||
const COLOR_ASCII_OTHER: Color = Color::Purple;
|
const COLOR_ASCII_OTHER: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Magenta)));
|
||||||
const COLOR_NONASCII: Color = Color::Yellow;
|
const COLOR_NONASCII: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Yellow)));
|
||||||
|
|
||||||
pub enum ByteCategory {
|
pub enum ByteCategory {
|
||||||
Null,
|
Null,
|
||||||
@@ -48,7 +47,7 @@ impl Byte {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn color(self) -> &'static Color {
|
fn color(self) -> &'static Style {
|
||||||
use crate::ByteCategory::*;
|
use crate::ByteCategory::*;
|
||||||
|
|
||||||
match self.category() {
|
match self.category() {
|
||||||
|
|||||||
Reference in new issue
Block a user