2021-03-15 13:53:30 -04:00
|
|
|
use termion::color;
|
|
|
|
|
2021-03-16 12:18:37 -04:00
|
|
|
#[derive(PartialEq, Clone, Copy)]
|
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-16 13:21:28 -04:00
|
|
|
MultilineComment,
|
2021-03-16 12:18:37 -04:00
|
|
|
PrimaryKeywords,
|
|
|
|
SecondaryKeywords,
|
2021-03-15 13:53:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Type {
|
2021-03-16 12:18:37 -04:00
|
|
|
pub fn to_color(self) -> impl color::Color {
|
2021-03-15 13:53:30 -04:00
|
|
|
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 13:21:28 -04:00
|
|
|
Type::Comment | Type::MultilineComment => color::Rgb(133, 153, 0),
|
2021-03-16 12:18:37 -04:00
|
|
|
Type::PrimaryKeywords => color::Rgb(181, 137, 0),
|
|
|
|
Type::SecondaryKeywords => color::Rgb(42, 161, 152),
|
2021-03-15 13:53:30 -04:00
|
|
|
_ => color::Rgb(255, 255, 255),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|