ui

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TitleStyle           lipgloss.Style
	BorderStyle          lipgloss.Style
	AddStyle             lipgloss.Style
	DelStyle             lipgloss.Style
	HeaderSeparatorStyle lipgloss.Style
	HeaderLineStyle      lipgloss.Style
	FooterStyle          lipgloss.Style
	ErrorBoxStyle        lipgloss.Style

	// File list sidebar styles
	FileListStyle        lipgloss.Style
	FileListStyleFocused lipgloss.Style
	FileListItemStyle    lipgloss.Style
	SelectedFileStyle    lipgloss.Style

	// Stats styles
	AdditionsStyle       lipgloss.Style
	DeletionsStyle       lipgloss.Style
	DeltaStyle           lipgloss.Style
	StatusModifiedStyle  lipgloss.Style
	StatusAddedStyle     lipgloss.Style
	StatusDeletedStyle   lipgloss.Style
	StatusUntrackedStyle lipgloss.Style

	// Border styles for focused/unfocused panes
	BorderStyleFocused   lipgloss.Style
	BorderStyleUnfocused lipgloss.Style

	// Search match highlighting styles
	SearchMatchStyle        lipgloss.Style
	SearchCurrentMatchStyle lipgloss.Style
	SearchInputStyle        lipgloss.Style

	// Branch selector styles
	BranchSelectorBoxStyle    lipgloss.Style
	BranchSelectorTitleStyle  lipgloss.Style
	BranchSelectorInputStyle  lipgloss.Style
	BranchSelectorFooterStyle lipgloss.Style
	CurrentBranchStyle        lipgloss.Style
	SelectedBranchStyle       lipgloss.Style
	BranchListItemStyle       lipgloss.Style
	BranchCountStyle          lipgloss.Style
)

All styles use the current theme colors

Functions

func ErrorBox

func ErrorBox(err error, width int) string

ErrorBox renders a stylized error message that can be embedded inside the layout.

func ListThemes

func ListThemes() []string

ListThemes returns all available theme names

func RenderBarChart added in v0.6.0

func RenderBarChart(additions, deletions, maxChanges, width int) string

RenderBarChart creates a visual bar chart using block characters.

func RenderCommitHistory added in v0.6.0

func RenderCommitHistory(history stats.CommitHistory, width int) string

RenderCommitHistory renders the list of recent commits.

func RenderFileList

func RenderFileList(files []git.FileStat, selectedIdx int) string

RenderFileList generates the sidebar content showing all modified files.

func RenderFileStat added in v0.6.0

func RenderFileStat(file git.FileStat, maxChanges, barWidth int) string

RenderFileStat renders a single file with status icon, stats, and bar chart.

func RenderFooter

func RenderFooter(showLineNumbers bool, fullContext bool, focusOnFileList bool, searchMode bool, showUntracked bool, searchInfo string, branchCompareMode bool, termWidth int) string

RenderFooter renders the footer with keyboard shortcuts and feature states. searchInfo format: "Match X of Y" or empty string if no search

func RenderSide

func RenderSide(rows []parser.DiffRow, side Side, showLineNumbers bool, searchMatches ...SearchMatch) string

RenderSide turns structured diff rows into a string suitable for a viewport. If searchMatches is provided, it highlights the matches in the output.

func RenderStatsFooter added in v0.6.0

func RenderStatsFooter(compareMode string, termWidth int) string

RenderStatsFooter renders footer with keyboard hints for stats view.

func RenderStatsSection added in v0.6.0

func RenderStatsSection(title string, s stats.Stats, width int) string

RenderStatsSection renders a single stats section with file list and summary.

func RenderStatsView added in v0.6.0

func RenderStatsView(branchStats *stats.BranchStats, width, height int) string

RenderStatsView renders the full stats screen for branch comparison.

func SetTheme

func SetTheme(name string)

SetTheme sets the active theme and updates all styles

func ValidateTheme

func ValidateTheme(name string) bool

ValidateTheme checks if a theme name is valid

Types

type SearchMatch

type SearchMatch struct {
	RowIndex  int
	Side      string
	Column    int
	Length    int
	IsCurrent bool
}

SearchMatch represents a search match for highlighting We define it here to avoid circular imports

type Side

type Side int
const (
	SideLeft Side = iota
	SideRight
)

type Theme

type Theme struct {
	Name string

	// Diff colors
	AdditionBg string
	AdditionFg string
	DeletionBg string
	DeletionFg string
	ContextFg  string
	HeaderFg   string

	// UI colors
	BorderColor        string
	FocusedBorderColor string
	TitleFg            string

	// File list colors
	ModifiedFg string
	AddedFg    string
	DeletedFg  string

	// General
	Background string
	Foreground string
}

Theme defines colors for all UI elements

func CatppuccinTheme

func CatppuccinTheme() Theme

CatppuccinTheme - Catppuccin Mocha color scheme

func DarkTheme

func DarkTheme() Theme

DarkTheme - Current default dark theme

func DraculaTheme

func DraculaTheme() Theme

DraculaTheme - Dracula color scheme

func GetTheme

func GetTheme() Theme

GetTheme returns the current theme

func GitHubTheme

func GitHubTheme() Theme

GitHubTheme - GitHub-style diff colors

func HighContrastTheme

func HighContrastTheme() Theme

HighContrastTheme - Maximum contrast for accessibility

func LightTheme

func LightTheme() Theme

LightTheme - Light background theme

func OneDarkTheme

func OneDarkTheme() Theme

OneDarkTheme - Atom's One Dark color scheme

func SolarizedTheme

func SolarizedTheme() Theme

SolarizedTheme - Solarized Dark color scheme

func TokyoNightTheme

func TokyoNightTheme() Theme

TokyoNightTheme - Tokyo Night color scheme

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL