Documentation
¶
Overview ¶
Package syntax is what code highlighting in base shares: the kinds of tokens, chroma's token types mapped onto them and NSH's palette, Allsum's, in light and dark.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Light = [Kinds]core.Style{ Comment: {Color: core.RGB(0x6e7781), FontStyle: core.FontStyleItalic}, Keyword: color(0x8250df), String: color(0x116329), Number: color(0x953800), Title: color(0x0550ae), Attr: color(0x7d4e00), Built: color(0x0a7285), Deletion: color(0xcf222e), Bold: {FontWeight: core.FontWeightBold}, Italic: {FontStyle: core.FontStyleItalic}, } Dark = [Kinds]core.Style{ Comment: {Color: core.RGB(0x7d7a72), FontStyle: core.FontStyleItalic}, Keyword: color(0xc4a7ff), String: color(0x9fd68a), Number: color(0xf5b27a), Title: color(0x82b8ff), Attr: color(0xf0c674), Built: color(0x6fd3d8), Deletion: color(0xf87171), Bold: {FontWeight: core.FontWeightBold}, Italic: {FontStyle: core.FontStyleItalic}, } )
Functions ¶
func HighlightLines ¶
func HighlightLines(h Highlighter, lines []string, from, to int) [][]Tok
HighlightLines runs h over lines from to to and returns their runs as Toks, sorted and clipped to each line.
Types ¶
type Highlighter ¶
type Highlighter interface {
// Highlight returns the tokens of lines from to to (exclusive) of
// lines, a snapshot of the whole text without line breaks: one slice
// per line, its tokens in bytes of the line.
Highlight(lines []string, from, to int) [][]Token
}
Highlighter is an app's highlighting of a language, in place of chroma's, for the Editor and the DiffView alike. It runs off the engine goroutine.
type Kind ¶
type Kind uint8
Kind is a kind of token in code, as NSH's palette names them.
const ( Plain Kind = iota Comment Keyword String Number Title Attr Built Deletion Bold Italic Kinds )
The kinds; Kinds counts them.