Documentation
¶
Overview ¶
Package highlight provides text selection and highlighting utilities.
Index ¶
- func Apply(content string, area image.Rectangle, startLine, startCol, endLine, endCol int, ...) string
- func Buffer(content string, area image.Rectangle, startLine, startCol, endLine, endCol int, ...) *uv.ScreenBuffer
- func Extract(content string, area image.Rectangle, startLine, startCol, endLine, endCol int) string
- type Highlighter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(content string, area image.Rectangle, startLine, startCol, endLine, endCol int, h Highlighter) string
Apply applies highlighting to a region of rendered ANSI content.
func Buffer ¶
func Buffer(content string, area image.Rectangle, startLine, startCol, endLine, endCol int, h Highlighter) *uv.ScreenBuffer
Buffer applies highlighting to a region and returns the screen buffer.
Types ¶
type Highlighter ¶
Highlighter defines how to style a cell during highlighting.
var Default Highlighter = func(x, y int, c *uv.Cell) *uv.Cell { if c == nil { return c } c.Style.Attrs |= uv.AttrReverse return c }
Default applies inverse style (reverse video) to cells.
func FromStyle ¶
func FromStyle(s lipgloss.Style) Highlighter
FromStyle converts a lipgloss.Style to a Highlighter.
func WithColors ¶
func WithColors(bg, fg color.Color) Highlighter
WithColors creates a highlighter using specific background and foreground colors.
Click to show internal directories.
Click to hide internal directories.