gilo/editor/highlight/fn.go
Timothy Warren f78bbdabb2
Some checks failed
timw4mail/gilo/pipeline/head There was a failure building this commit
Up to step 154 in Kilo tutorial (chapter 7)
2021-04-07 16:26:05 -04:00

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
}