Documentation
¶
Overview ¶
Package highlight provides small, terminal-safe syntax highlighting for human-facing previews. It deliberately does not alter source content or participate in scanning, token counts, or selection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ANSI ¶ added in v1.2.0
ANSI builds a truecolor SGR sequence for hex (e.g. "#cba6f7" or "cba6f7") with optional SGR modifiers ("1" for bold, "2" for faint). It returns "" for unparseable input so callers degrade to unstyled text.
func Render ¶
Render highlights complete content. It is intended for a terminal writer; callers must decide whether their output is a TTY before enabling it.
func RenderLine ¶
RenderLine highlights one line. Keeping this operation line-local makes it suitable for the TUI, which can render only the visible preview rows.
Types ¶
type Options ¶
type Options struct {
Enabled bool
Theme Theme
MaxBytes int
// Palette overrides the built-in Theme palette when non-nil. The TUI
// sets it from the active color preset so preview highlighting follows
// the picker's theme; Theme is kept as the fallback.
Palette *Palette
}
Options controls terminal highlighting.