parent
280ed71ec1
commit
7a898206fa
@ -14,6 +14,7 @@ pub struct Color(pub Option<u8>);
|
|||||||
impl Display for Color {
|
impl Display for Color {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
|
Some(color @ 0..=7) => write!(f, "\x1b[3{color}m"),
|
||||||
Some(color) => write!(f, "\x1b[38;5;{color}m"),
|
Some(color) => write!(f, "\x1b[38;5;{color}m"),
|
||||||
None => write!(f, "\x1b[39m"),
|
None => write!(f, "\x1b[39m"),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user