2021-08-13 11:16:57 -04:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Aviat\Kilo;
|
|
|
|
|
|
|
|
use Aviat\Kilo\Enum\Color;
|
|
|
|
use Aviat\Kilo\Enum\Highlight;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configure syntax highlighting colors
|
|
|
|
*
|
2021-12-03 11:59:42 -05:00
|
|
|
* @param Highlight $hl
|
|
|
|
* @return Color
|
2021-08-13 11:16:57 -04:00
|
|
|
*/
|
2021-12-03 11:59:42 -05:00
|
|
|
function get_syntax_color(Highlight $hl): Color {
|
2021-08-13 11:16:57 -04:00
|
|
|
return match ($hl)
|
|
|
|
{
|
2021-12-03 11:59:42 -05:00
|
|
|
Highlight::Comment => Color::FG_CYAN,
|
|
|
|
Highlight::MultiLineComment => Color::FG_BRIGHT_BLACK,
|
|
|
|
Highlight::Keyword1 => Color::FG_YELLOW,
|
|
|
|
Highlight::Keyword2 => Color::FG_GREEN,
|
|
|
|
Highlight::String => Color::FG_MAGENTA,
|
|
|
|
Highlight::Character => Color::FG_BRIGHT_MAGENTA,
|
|
|
|
Highlight::Number => Color::FG_BRIGHT_RED,
|
|
|
|
Highlight::Operator => Color::FG_BRIGHT_GREEN,
|
|
|
|
Highlight::Variable => Color::FG_BRIGHT_CYAN,
|
|
|
|
Highlight::Delimiter => Color::FG_BLUE,
|
|
|
|
Highlight::Invalid => Color::BG_BRIGHT_RED,
|
|
|
|
Highlight::SearchMatch => Color::INVERT,
|
|
|
|
Highlight::Identifier => Color::FG_BRIGHT_WHITE,
|
2021-08-13 11:16:57 -04:00
|
|
|
default => Color::FG_WHITE,
|
|
|
|
};
|
|
|
|
}
|