Documentation
¶
Overview ¶
Code generated by enum generator; DO NOT EDIT.
Code generated by enum generator; DO NOT EDIT.
Index ¶
- Variables
- func AnsiFg(hex string) string
- func ColorKeyIter() func(yield func(ColorKey) bool)
- func StyleKeyIter() func(yield func(StyleKey) bool)
- func Write(w io.Writer, c Color) (int, error)
- type Color
- type ColorKey
- type Colors
- type Renderer
- func (r Renderer) AnnotationInline(text string) string
- func (r Renderer) DiffCursor(noColors bool) string
- func (r Renderer) FileAnnotationMark() string
- func (r Renderer) FileReviewedMark() string
- func (r Renderer) FileStatusMark(status diff.FileStatus) string
- func (r Renderer) StatusBarSeparator() string
- type Resolver
- func (r Resolver) Color(k ColorKey) Color
- func (r Resolver) IndicatorBg(change diff.ChangeType) Color
- func (r Resolver) LineBg(change diff.ChangeType) Color
- func (r Resolver) LineStyle(change diff.ChangeType, highlighted bool) lipgloss.Style
- func (r Resolver) Style(k StyleKey) lipgloss.Style
- func (r Resolver) WordDiffBg(change diff.ChangeType) Color
- type SGR
- type StyleKey
Constants ¶
This section is empty.
Variables ¶
var ( // zero value sentinel ColorKeyUnknown = ColorKey{/* contains filtered or unexported fields */} ColorKeyAccentFg = ColorKey{/* contains filtered or unexported fields */} ColorKeyMutedFg = ColorKey{/* contains filtered or unexported fields */} ColorKeyAnnotationFg = ColorKey{/* contains filtered or unexported fields */} // internal fallback: StatusFg || MutedFg ColorKeyStatusFg = ColorKey{/* contains filtered or unexported fields */} ColorKeyTreePaneBg = ColorKey{/* contains filtered or unexported fields */} ColorKeyDiffPaneBg = ColorKey{/* contains filtered or unexported fields */} ColorKeyAddLineBg = ColorKey{/* contains filtered or unexported fields */} ColorKeyRemoveLineBg = ColorKey{/* contains filtered or unexported fields */} ColorKeyModifyLineBg = ColorKey{/* contains filtered or unexported fields */} ColorKeyWordAddBg = ColorKey{/* contains filtered or unexported fields */} ColorKeyWordRemoveBg = ColorKey{/* contains filtered or unexported fields */} ColorKeySearchBg = ColorKey{/* contains filtered or unexported fields */} ColorKeyAddLineFg = ColorKey{/* contains filtered or unexported fields */} ColorKeyRemoveLineFg = ColorKey{/* contains filtered or unexported fields */} ColorKeyNormalFg = ColorKey{/* contains filtered or unexported fields */} ColorKeySelectedFg = ColorKey{/* contains filtered or unexported fields */} )
Public constants for colorKey values
var ( StyleKeyUnknown = StyleKey{/* contains filtered or unexported fields */} // diff line styles StyleKeyLineAdd = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineRemove = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineContext = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineModify = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineAddHighlight = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineRemoveHighlight = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineContextHighlight = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineModifyHighlight = StyleKey{/* contains filtered or unexported fields */} StyleKeyLineNumber = StyleKey{/* contains filtered or unexported fields */} // pane styles StyleKeyTreePane = StyleKey{/* contains filtered or unexported fields */} StyleKeyTreePaneActive = StyleKey{/* contains filtered or unexported fields */} StyleKeyDiffPane = StyleKey{/* contains filtered or unexported fields */} StyleKeyDiffPaneActive = StyleKey{/* contains filtered or unexported fields */} // file tree entry styles StyleKeyDirEntry = StyleKey{/* contains filtered or unexported fields */} StyleKeyFileEntry = StyleKey{/* contains filtered or unexported fields */} StyleKeyFileSelected = StyleKey{/* contains filtered or unexported fields */} StyleKeyAnnotationMark = StyleKey{/* contains filtered or unexported fields */} StyleKeyReviewedMark = StyleKey{/* contains filtered or unexported fields */} // file status styles StyleKeyStatusAdded = StyleKey{/* contains filtered or unexported fields */} StyleKeyStatusDeleted = StyleKey{/* contains filtered or unexported fields */} StyleKeyStatusUntracked = StyleKey{/* contains filtered or unexported fields */} StyleKeyStatusDefault = StyleKey{/* contains filtered or unexported fields */} // chrome styles StyleKeyStatusBar = StyleKey{/* contains filtered or unexported fields */} StyleKeySearchMatch = StyleKey{/* contains filtered or unexported fields */} // ti.TextStyle / ti.PromptStyle in newAnnotationInput StyleKeyAnnotInputText = StyleKey{/* contains filtered or unexported fields */} // ti.PlaceholderStyle StyleKeyAnnotInputPlaceholder = StyleKey{/* contains filtered or unexported fields */} // ti.Cursor.Style / ti.Cursor.TextStyle StyleKeyAnnotInputCursor = StyleKey{/* contains filtered or unexported fields */} // annotation list popup border StyleKeyAnnotListBorder = StyleKey{/* contains filtered or unexported fields */} // help overlay box StyleKeyHelpBox = StyleKey{/* contains filtered or unexported fields */} // theme selector box StyleKeyThemeSelectBox = StyleKey{/* contains filtered or unexported fields */} // theme selector focused state StyleKeyThemeSelectBoxFocused = StyleKey{/* contains filtered or unexported fields */} )
Public constants for styleKey values
var ColorKeyNames = []string{
"Unknown",
"AccentFg",
"MutedFg",
"AnnotationFg",
"StatusFg",
"TreePaneBg",
"DiffPaneBg",
"AddLineBg",
"RemoveLineBg",
"ModifyLineBg",
"WordAddBg",
"WordRemoveBg",
"SearchBg",
"AddLineFg",
"RemoveLineFg",
"NormalFg",
"SelectedFg",
}
ColorKeyNames contains all possible enum names
var ColorKeyValues = []ColorKey{ ColorKeyUnknown, ColorKeyAccentFg, ColorKeyMutedFg, ColorKeyAnnotationFg, ColorKeyStatusFg, ColorKeyTreePaneBg, ColorKeyDiffPaneBg, ColorKeyAddLineBg, ColorKeyRemoveLineBg, ColorKeyModifyLineBg, ColorKeyWordAddBg, ColorKeyWordRemoveBg, ColorKeySearchBg, ColorKeyAddLineFg, ColorKeyRemoveLineFg, ColorKeyNormalFg, ColorKeySelectedFg, }
ColorKeyValues contains all possible enum values
var StyleKeyNames = []string{
"Unknown",
"LineAdd",
"LineRemove",
"LineContext",
"LineModify",
"LineAddHighlight",
"LineRemoveHighlight",
"LineContextHighlight",
"LineModifyHighlight",
"LineNumber",
"TreePane",
"TreePaneActive",
"DiffPane",
"DiffPaneActive",
"DirEntry",
"FileEntry",
"FileSelected",
"AnnotationMark",
"ReviewedMark",
"StatusAdded",
"StatusDeleted",
"StatusUntracked",
"StatusDefault",
"StatusBar",
"SearchMatch",
"AnnotInputText",
"AnnotInputPlaceholder",
"AnnotInputCursor",
"AnnotListBorder",
"HelpBox",
"ThemeSelectBox",
"ThemeSelectBoxFocused",
}
StyleKeyNames contains all possible enum names
var StyleKeyValues = []StyleKey{ StyleKeyUnknown, StyleKeyLineAdd, StyleKeyLineRemove, StyleKeyLineContext, StyleKeyLineModify, StyleKeyLineAddHighlight, StyleKeyLineRemoveHighlight, StyleKeyLineContextHighlight, StyleKeyLineModifyHighlight, StyleKeyLineNumber, StyleKeyTreePane, StyleKeyTreePaneActive, StyleKeyDiffPane, StyleKeyDiffPaneActive, StyleKeyDirEntry, StyleKeyFileEntry, StyleKeyFileSelected, StyleKeyAnnotationMark, StyleKeyReviewedMark, StyleKeyStatusAdded, StyleKeyStatusDeleted, StyleKeyStatusUntracked, StyleKeyStatusDefault, StyleKeyStatusBar, StyleKeySearchMatch, StyleKeyAnnotInputText, StyleKeyAnnotInputPlaceholder, StyleKeyAnnotInputCursor, StyleKeyAnnotListBorder, StyleKeyHelpBox, StyleKeyThemeSelectBox, StyleKeyThemeSelectBoxFocused, }
StyleKeyValues contains all possible enum values
Functions ¶
func AnsiFg ¶
AnsiFg returns an ANSI 24-bit foreground color escape for a #RRGGBB hex string. returns empty string for invalid input.
func ColorKeyIter ¶
ColorKeyIter returns a function compatible with Go 1.23's range-over-func syntax. It yields all ColorKey values in declaration order. Example:
for v := range ColorKeyIter() {
// use v
}
func StyleKeyIter ¶
StyleKeyIter returns a function compatible with Go 1.23's range-over-func syntax. It yields all StyleKey values in declaration order. Example:
for v := range StyleKeyIter() {
// use v
}
Types ¶
type Color ¶
type Color string
Color is an ANSI escape sequence ready to write to a terminal stream. Zero value is an empty Color (no-op when written).
Color has no methods. fmt verbs work on the underlying string value (since Color is a string type alias), and emptiness is checked with c != "". The style.Write(w, c) helper handles io.Writer cases that need a string() cast. If a specific call site later requires methods on Color, add them then — not speculatively.
type ColorKey ¶
type ColorKey struct {
// contains filtered or unexported fields
}
ColorKey is the exported type for the enum
func MustColorKey ¶
MustColorKey is like ParseColorKey but panics if string is invalid
func ParseColorKey ¶
ParseColorKey converts string to colorKey enum value. Parsing is always case-insensitive.
func (ColorKey) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*ColorKey) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Colors ¶
type Colors struct {
Accent string // active pane borders, dir names
Border string // inactive pane borders
Normal string // file entries, context lines
Muted string // divider lines, status bar
SelectedFg string // selected file text
SelectedBg string // selected file background
Annotation string // annotation text and markers
CursorFg string // diff cursor indicator foreground
CursorBg string // diff cursor line background
AddFg string // added line foreground
AddBg string // added line background
RemoveFg string // removed line foreground
RemoveBg string // removed line background
WordAddBg string // intra-line word-diff add background (auto-derived if empty)
WordRemoveBg string // intra-line word-diff remove background (auto-derived if empty)
ModifyFg string // modified line foreground (collapsed mode)
ModifyBg string // modified line background (collapsed mode)
TreeBg string // file tree pane background
DiffBg string // diff pane background
StatusFg string // status bar foreground
StatusBg string // status bar background
SearchFg string // search match foreground
SearchBg string // search match background
}
Colors holds hex color values (#rrggbb) for TUI rendering. This is the construction input for NewResolver — it is not part of any type's runtime API.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer produces complete rendered strings for specific UI widgets (annotation marks, cursor cells, status separators, file status marks). It composes multiple Color lookups into final ANSI-tagged strings.
func NewRenderer ¶
NewRenderer wires a Renderer to a Resolver. The caller is responsible for constructing the Resolver first (via NewResolver or PlainResolver).
func (Renderer) AnnotationInline ¶
AnnotationInline renders an inline annotation with italic styling using raw ANSI sequences. uses AnnotationFg and DiffPaneBg from the resolver.
func (Renderer) DiffCursor ¶
DiffCursor renders the cursor glyph using raw ANSI sequences instead of lipgloss.Render() to avoid \033[0m full reset that kills the outer DiffBg background. when noColors is true, falls back to reverse video.
func (Renderer) FileAnnotationMark ¶
FileAnnotationMark returns a colored annotation marker for files with annotations. uses AnnotationFg with ResetFg after the marker.
func (Renderer) FileReviewedMark ¶
FileReviewedMark returns a colored checkmark for reviewed files. uses AddFg for the checkmark and Normal for the reset; falls back to ResetFg when Colors.Normal is empty to prevent the AddFg color from bleeding into subsequent text on the same line.
func (Renderer) FileStatusMark ¶
func (r Renderer) FileStatusMark(status diff.FileStatus) string
FileStatusMark returns a colored file status character (A, M, D, ?, etc.) followed by a space, using raw ANSI sequences to avoid lipgloss full reset. restores the Normal foreground after the status character; falls back to ResetFg when Colors.Normal is empty to prevent the status color from bleeding into subsequent text on the same line.
func (Renderer) StatusBarSeparator ¶
StatusBarSeparator returns a separator string for the status bar, styled with muted foreground for the pipe and status foreground for the surrounding spaces.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver holds pre-materialized color and lipgloss style tables and dispatches lookups by key or by diff.ChangeType. All fields are private — callers access values through methods only.
func NewResolver ¶
NewResolver builds a Resolver from a Colors palette. Normalizes the input, builds all lipgloss.Style values, stores them privately.
func PlainResolver ¶
func PlainResolver() Resolver
PlainResolver returns a Resolver with no-color styling — used for --no-colors mode. Borders are preserved; all color styling is stripped.
func (Resolver) Color ¶
Color returns the ANSI escape sequence for the given color key. ColorKeyStatusFg falls back to MutedFg when Colors.StatusFg is empty. returns empty Color for ColorKeyUnknown.
func (Resolver) IndicatorBg ¶
func (r Resolver) IndicatorBg(change diff.ChangeType) Color
IndicatorBg returns the background color for a horizontal scroll indicator, falling back to the diff pane background when the line has no explicit bg.
func (Resolver) LineBg ¶
func (r Resolver) LineBg(change diff.ChangeType) Color
LineBg returns the ANSI background escape sequence for a diff change type. ChangeAdd → AddBg, ChangeRemove → RemoveBg, everything else → empty.
func (Resolver) LineStyle ¶
LineStyle returns the lipgloss.Style for a diff line based on change type and whether syntax highlighting is active.
func (Resolver) Style ¶
Style returns the pre-built lipgloss.Style for the given style key. returns an empty lipgloss.Style for unknown keys.
func (Resolver) WordDiffBg ¶
func (r Resolver) WordDiffBg(change diff.ChangeType) Color
WordDiffBg returns the ANSI background escape for intra-line word-diff highlighting. ChangeAdd → WordAddBg, ChangeRemove → WordRemoveBg, everything else → empty.
type SGR ¶
type SGR struct{}
SGR handles re-emission of ANSI SGR (Select Graphic Rendition) state across line boundaries. it is stateless and zero-value usable — the type exists to provide a method namespace for the consumer-side sgrProcessor interface contract.
type StyleKey ¶
type StyleKey struct {
// contains filtered or unexported fields
}
StyleKey is the exported type for the enum
func MustStyleKey ¶
MustStyleKey is like ParseStyleKey but panics if string is invalid
func ParseStyleKey ¶
ParseStyleKey converts string to styleKey enum value. Parsing is always case-insensitive.
func (StyleKey) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*StyleKey) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler