Help us shape the future of Go! Take the 2026 Go Developer Survey

ui

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Neutral surfaces — darkest to brightest
	ColorBase    = lipgloss.Color("#08080f") // deepest bg
	ColorMantle  = lipgloss.Color("#0e0e1a") // header/footer bar
	ColorCrust   = lipgloss.Color("#13131e") // panel bg
	ColorSurface = lipgloss.Color("#1a1a2a") // selected row bg
	ColorOverlay = lipgloss.Color("#252538") // borders unfocused
	ColorMuted   = lipgloss.Color("#3d3d5c") // truly dim
	ColorSubtext = lipgloss.Color("#7878a0") // secondary text
	ColorText    = lipgloss.Color("#d8d8ee") // primary text

	// L2 — ONE primary accent: electric violet
	ColorAccent    = lipgloss.Color("#7c6dfa") // focus / active / interactive
	ColorAccentDim = lipgloss.Color("#4a3faa") // unfocused accent

	// L3 Semantic — git / diff / status
	ColorGreen  = lipgloss.Color("#3ecf8e") // added · success · current branch
	ColorRed    = lipgloss.Color("#e05454") // removed · error · conflict
	ColorAmber  = lipgloss.Color("#d4a017") // warning · staged · rebase
	ColorBlue   = lipgloss.Color("#4d9de0") // branches · info · remote
	ColorPurple = lipgloss.Color("#a87efb") // author · merge · reword
	ColorPeach  = lipgloss.Color("#e8835c") // commit hash · section headers
	ColorTeal   = lipgloss.Color("#2ec4b6") // AI · teal accent
	ColorSky    = lipgloss.Color("#7c6dfa") // alias → same as Accent
	ColorYellow = lipgloss.Color("#d4a017") // alias → same as Amber
	ColorOrange = lipgloss.Color("#e8835c") // alias → same as Peach
	ColorPink   = lipgloss.Color("#e879a8") // renamed files
)

── Color Palette — Deep Noir (inspired by Linear.app × deep space) ───────────

3-tier accent discipline:

L1 Neutral  — 6 surface depths (background → text)
L2 Accent   — ONE interactive color: electric violet #7c6dfa
L3 Semantic — green (added/ok) · red (removed/err) · amber (warn)

Variables

View Source
var DefaultTheme = Theme{
	FocusedBorder: lipgloss.NewStyle().
		Border(lipgloss.RoundedBorder()).
		BorderForeground(ColorAccent),

	UnfocusedBorder: lipgloss.NewStyle().
		Border(lipgloss.RoundedBorder()).
		BorderForeground(ColorOverlay),

	Title:    lipgloss.NewStyle().Foreground(ColorAccent).Bold(true),
	Subtitle: lipgloss.NewStyle().Foreground(ColorSubtext),
	Normal:   lipgloss.NewStyle().Foreground(ColorText),
	Muted:    lipgloss.NewStyle().Foreground(ColorMuted),
	Bold:     lipgloss.NewStyle().Foreground(ColorText).Bold(true),

	Selected: lipgloss.NewStyle().
		Background(ColorSurface).
		Foreground(ColorText),
	Cursor: lipgloss.NewStyle().
		Background(ColorAccent).
		Foreground(ColorBase).
		Bold(true),

	BadgeModified:  lipgloss.NewStyle().Foreground(ColorAmber).Bold(true),
	BadgeAdded:     lipgloss.NewStyle().Foreground(ColorGreen).Bold(true),
	BadgeDeleted:   lipgloss.NewStyle().Foreground(ColorRed).Bold(true),
	BadgeUntracked: lipgloss.NewStyle().Foreground(ColorPeach).Bold(true),
	BadgeConflict:  lipgloss.NewStyle().Foreground(ColorRed).Bold(true),
	BadgeRenamed:   lipgloss.NewStyle().Foreground(ColorPink).Bold(true),

	DiffAdded:   lipgloss.NewStyle().Foreground(ColorGreen),
	DiffRemoved: lipgloss.NewStyle().Foreground(ColorRed),
	DiffContext: lipgloss.NewStyle().Foreground(ColorSubtext),
	DiffHeader:  lipgloss.NewStyle().Foreground(ColorBlue).Bold(true),
	DiffHunk:    lipgloss.NewStyle().Foreground(ColorTeal),

	BranchCurrent: lipgloss.NewStyle().Foreground(ColorGreen).Bold(true),
	BranchNormal:  lipgloss.NewStyle().Foreground(ColorText),
	BranchRemote:  lipgloss.NewStyle().Foreground(ColorSubtext),

	CommitHash:    lipgloss.NewStyle().Foreground(ColorPeach).Bold(true),
	CommitSubject: lipgloss.NewStyle().Foreground(ColorText),
	CommitAuthor:  lipgloss.NewStyle().Foreground(ColorPurple),
	CommitDate:    lipgloss.NewStyle().Foreground(ColorMuted),
	CommitRef:     lipgloss.NewStyle().Foreground(ColorAmber),

	StatusBar: lipgloss.NewStyle().
		Background(ColorMantle).
		Foreground(ColorText),
	StatusKey: lipgloss.NewStyle().
		Background(ColorMantle).
		Foreground(ColorAccent).
		Bold(true),
	StatusValue: lipgloss.NewStyle().
		Background(ColorMantle).
		Foreground(ColorSubtext),
	StatusSep: lipgloss.NewStyle().
		Background(ColorMantle).
		Foreground(ColorOverlay),

	HelpKey:   lipgloss.NewStyle().Foreground(ColorAccent).Bold(true),
	HelpValue: lipgloss.NewStyle().Foreground(ColorSubtext),
}

DefaultTheme returns the noir dark theme.

Functions

This section is empty.

Types

type AIChunkMsg

type AIChunkMsg struct{ Text string }

AI streaming messages

type AIDoneMsg

type AIDoneMsg struct{}

type AIErrorMsg

type AIErrorMsg struct{ Err error }

type AISummaryMsg

type AISummaryMsg struct{ Text string }

AISummaryMsg is emitted when the diff summary generation completes.

type AccountDeleteMsg added in v0.3.0

type AccountDeleteMsg struct {
	Name      string
	ForgeType string // "github" or "gitlab"
}

AccountDeleteMsg requests deletion of a named account entry.

type GitBisectMsg added in v0.2.1

type GitBisectMsg struct {
	Status git.BisectStatus
	Err    error
}

type GitBlameMsg

type GitBlameMsg struct {
	Lines []git.BlameLine
	Err   error
}

type GitBranchesMsg

type GitBranchesMsg struct {
	Branches []git.Branch
	Err      error
}

type GitCommitsMsg

type GitCommitsMsg struct {
	Commits []git.Commit
	Err     error
}

type GitConflictMsg added in v0.2.1

type GitConflictMsg struct {
	Path   string
	Blocks []git.ConflictBlock
	Err    error
}

type GitDiffMsg

type GitDiffMsg struct {
	Hunks  []git.DiffHunk
	Staged bool
	Err    error
}

type GitFileHistoryMsg added in v0.2.1

type GitFileHistoryMsg struct {
	Path    string
	Commits []git.Commit
	Err     error
}

type GitGraphMsg

type GitGraphMsg struct {
	Lines []string
	Err   error
}

type GitHeadCommitMsg added in v0.2.1

type GitHeadCommitMsg struct {
	Subject string
	Body    string
	Err     error
}

GitHeadCommitMsg carries the HEAD commit subject+body for amend mode.

type GitOperationMsg

type GitOperationMsg struct {
	Op  string
	Err error
}

type GitPRsMsg

type GitPRsMsg struct {
	PRs []forge.PullRequest
	Err error
}

type GitRebaseTodoMsg added in v0.2.1

type GitRebaseTodoMsg struct {
	Entries  []git.RebaseTodoEntry
	TodoPath string
	Err      error
}

type GitReflogMsg

type GitReflogMsg struct {
	Entries []git.ReflogEntry
	Err     error
}

type GitRemotesMsg added in v0.2.1

type GitRemotesMsg struct {
	Remotes []git.RemoteEntry
	Err     error
}

type GitStashDiffMsg

type GitStashDiffMsg struct {
	FileDiffs []git.FileDiff
	Err       error
}

type GitStashMsg

type GitStashMsg struct {
	Stashes []git.StashEntry
	Err     error
}

type GitStatusMsg

type GitStatusMsg struct {
	Files []git.FileStatus
	Err   error
}

type GitTagsMsg added in v0.2.1

type GitTagsMsg struct {
	Tags []git.Tag
	Err  error
}

type GitWorktreesMsg added in v0.2.1

type GitWorktreesMsg struct {
	Worktrees []git.Worktree
	Err       error
}

type KeyMap

type KeyMap struct {
	// Navigation
	Up       key.Binding
	Down     key.Binding
	Left     key.Binding
	Right    key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Top      key.Binding
	Bottom   key.Binding

	// Panel focus
	FocusFiles    key.Binding
	FocusBranches key.Binding
	FocusCommits  key.Binding
	FocusDiff     key.Binding
	NextPanel     key.Binding
	PrevPanel     key.Binding

	// Git actions
	Stage        key.Binding
	Unstage      key.Binding
	StageAll     key.Binding
	Discard      key.Binding
	Commit       key.Binding
	Push         key.Binding
	Pull         key.Binding
	Fetch        key.Binding
	Checkout     key.Binding
	NewBranch    key.Binding
	Delete       key.Binding
	CherryPick   key.Binding
	Tags         key.Binding
	Revert       key.Binding
	Reset        key.Binding
	RenameBranch key.Binding
	Merge        key.Binding
	Rebase       key.Binding
	FileHistory  key.Binding
	Worktree     key.Binding
	InterRebase  key.Binding
	OpenBrowser  key.Binding
	Remotes      key.Binding
	Bisect       key.Binding

	// View toggles
	ToggleSideBySide key.Binding
	ToggleDiffStaged key.Binding

	// App
	Palette  key.Binding
	Settings key.Binding
	Help     key.Binding
	Quit     key.Binding
	Refresh  key.Binding
	Search   key.Binding
	Escape   key.Binding
	Confirm  key.Binding
}

KeyMap holds all keybindings for sugi. This single struct drives both input handling and the help overlay.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings.

type Layout

type Layout struct {
	TotalWidth  int
	TotalHeight int

	// Left column (Files + Branches + Commits)
	LeftWidth  int
	LeftHeight int

	// Right column (Diff)
	RightWidth  int
	RightHeight int

	// Header / footer heights
	HeaderHeight int
	FooterHeight int

	// Content heights (inside borders)
	PanelContentHeight int
	DiffContentHeight  int

	// Responsive mode
	IsNarrow     bool // < 100 cols: two panels, no diff side-by-side
	IsVeryNarrow bool // < 60 cols: single panel
}

Layout holds computed dimensions for the current terminal size.

func ComputeLayout

func ComputeLayout(width, height int) Layout

ComputeLayout calculates panel dimensions from terminal size.

type Mode

type Mode int
const (
	ModeNormal Mode = iota
	ModeCommit
	ModeHelp
	ModeNewBranch
	ModeStash
	ModeBlame
	ModeReflog
	ModeSearch
	ModePR
	ModeAIGenerating
	ModePalette
	ModeAISummary
	ModeSettings
	ModeConfirm      // destructive action confirmation dialog
	ModeNewTag       // new tag name input
	ModeRenameBranch // rename branch input
	ModeReset        // waiting for s/m/h after X
	ModeWorktree     // worktrees panel
	ModeInterRebase  // interactive rebase panel
	ModeConflict     // merge conflict resolution panel
	ModeFileHistory  // file history panel
	ModeRemotes      // remotes management panel
	ModeAddRemote    // adding a new remote (two-step modal)
	ModeBisect       // git bisect panel
	ModeAccounts     // accounts management panel
	ModeAddAccount   // add-account modal within accounts panel
)

type Model

type Model struct {
	// contains filtered or unexported fields
}

func New

func New(repo *git.Client, cfg config.Config, forgeClient forge.ForgeClient, aiGen *ai.Generator) Model

New creates the root model. forgeClient and aiGen may be nil.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type PanelID

type PanelID int

PanelID identifies which panel is focused.

const (
	PanelStash       PanelID = 10
	PanelBlame       PanelID = 11
	PanelReflog      PanelID = 12
	PanelPR          PanelID = 13
	PanelTags        PanelID = 14
	PanelWorktree    PanelID = 15
	PanelInterRebase PanelID = 16
	PanelConflict    PanelID = 17
	PanelFileHistory PanelID = 18
	PanelRemotes     PanelID = 19
	PanelBisect      PanelID = 20
	PanelAccounts    PanelID = 21
)

Extended PanelIDs (beyond the core 0-4 in layout.go)

const (
	PanelFiles PanelID = iota
	PanelBranches
	PanelCommits
	PanelDiff
	PanelCommitMsg
)

type ResizeMsg added in v0.3.0

type ResizeMsg struct{ W, H int }

ResizeMsg is emitted 50 ms after a WindowSizeMsg to debounce rapid resize events.

type SettingsSavedMsg

type SettingsSavedMsg struct{ Cfg config.Config }

SettingsSavedMsg is emitted after settings are written to disk.

type StatusMsg

type StatusMsg struct {
	Text  string
	IsErr bool
}

type Theme

type Theme struct {
	// Borders
	FocusedBorder   lipgloss.Style
	UnfocusedBorder lipgloss.Style

	// Text hierarchy
	Title    lipgloss.Style
	Subtitle lipgloss.Style
	Normal   lipgloss.Style
	Muted    lipgloss.Style
	Bold     lipgloss.Style

	// Selection
	Selected lipgloss.Style
	Cursor   lipgloss.Style

	// Git status badges (compact, icon-first)
	BadgeModified  lipgloss.Style
	BadgeAdded     lipgloss.Style
	BadgeDeleted   lipgloss.Style
	BadgeUntracked lipgloss.Style
	BadgeConflict  lipgloss.Style
	BadgeRenamed   lipgloss.Style

	// Diff
	DiffAdded   lipgloss.Style
	DiffRemoved lipgloss.Style
	DiffContext lipgloss.Style
	DiffHeader  lipgloss.Style
	DiffHunk    lipgloss.Style

	// Branch
	BranchCurrent lipgloss.Style
	BranchNormal  lipgloss.Style
	BranchRemote  lipgloss.Style

	// Commit
	CommitHash    lipgloss.Style
	CommitSubject lipgloss.Style
	CommitAuthor  lipgloss.Style
	CommitDate    lipgloss.Style
	CommitRef     lipgloss.Style

	// Status bar
	StatusBar   lipgloss.Style
	StatusKey   lipgloss.Style
	StatusValue lipgloss.Style
	StatusSep   lipgloss.Style

	// Help
	HelpKey   lipgloss.Style
	HelpValue lipgloss.Style
}

Theme holds all Lipgloss styles used throughout the TUI.

type TickMsg added in v0.2.1

type TickMsg struct{}

TickMsg is emitted by the auto-refresh ticker.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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