21 lines
406 B
Go
21 lines
406 B
Go
package highlight
|
|
|
|
import "timshome.page/gilo/terminal"
|
|
|
|
var syntaxColorMap = map[int]string{
|
|
Number: terminal.FGRed,
|
|
Match: terminal.FGBlue,
|
|
Normal: terminal.DefaultFGColor,
|
|
}
|
|
|
|
// Take a highlighting type and map it to
|
|
// an ANSI color escape code for display
|
|
func SyntaxToColor(hl int) string {
|
|
color := syntaxColorMap[hl]
|
|
if len(color) == 0 {
|
|
color = terminal.DefaultFGColor
|
|
}
|
|
|
|
return color
|
|
}
|