hecto/src/highlighting.rs

25 lines
553 B
Rust
Raw Normal View History

2021-03-15 13:53:30 -04:00
use termion::color;
2021-03-15 14:37:41 -04:00
#[derive(PartialEq)]
2021-03-15 13:53:30 -04:00
pub enum Type {
None,
Number,
2021-03-15 14:53:08 -04:00
Match,
2021-03-16 10:45:19 -04:00
String,
2021-03-16 10:57:15 -04:00
Character,
2021-03-16 11:02:27 -04:00
Comment,
2021-03-15 13:53:30 -04:00
}
impl Type {
pub fn to_color(&self) -> impl color::Color {
match self {
Type::Number => color::Rgb(220, 163, 163),
2021-03-15 14:53:08 -04:00
Type::Match => color::Rgb(38, 139, 210),
2021-03-16 10:45:19 -04:00
Type::String => color::Rgb(211, 54, 130),
2021-03-16 10:57:15 -04:00
Type::Character => color::Rgb(108, 113, 196),
2021-03-16 11:02:27 -04:00
Type::Comment => color::Rgb(133, 153, 0),
2021-03-15 13:53:30 -04:00
_ => color::Rgb(255, 255, 255),
}
}
}