ui

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorBase    = lipgloss.Color("#1e1e2e")
	ColorDeepBg  = lipgloss.Color("#11111a")
	ColorText    = lipgloss.Color("#cdd6f4")
	ColorSubtle  = lipgloss.Color("#a6adc8")
	ColorBlue    = lipgloss.Color("#89b4fa")
	ColorGreen   = lipgloss.Color("#a6e3a1")
	ColorYellow  = lipgloss.Color("#f9e2af")
	ColorRed     = lipgloss.Color("#f38ba8")
	ColorOrange  = lipgloss.Color("#fab387")
	ColorMauve   = lipgloss.Color("#cba6f7")
	ColorTeal    = lipgloss.Color("#94e2d5")
	ColorSurface = lipgloss.Color("#313244")
)

Base palette. This follows the Catppuccin-inspired colors already used by the status UI so the rest of the app can share one visual language.

View Source
var (
	ColorGray    = ColorSubtle
	ColorBorder  = ColorSubtle
	ColorCyan    = ColorTeal
	ColorMagenta = ColorMauve
)

Backwards-compatible aliases still used by some call sites.

View Source
var (
	StyleTitle       = lipgloss.NewStyle().Foreground(ColorBlue).Bold(true)
	StyleHeading     = lipgloss.NewStyle().Foreground(ColorText).Bold(true)
	StyleHelpHeading = lipgloss.NewStyle().Foreground(ColorOrange).Bold(true)

	StyleStrong   = lipgloss.NewStyle().Foreground(ColorText).Bold(true)
	StyleBody     = lipgloss.NewStyle().Foreground(ColorText)
	StyleMuted    = lipgloss.NewStyle().Foreground(ColorSubtle)
	StyleHint     = lipgloss.NewStyle().Foreground(ColorSubtle)
	StyleCodeLike = lipgloss.NewStyle().Foreground(ColorTeal)
)

Semantic text and surface styles.

View Source
var (
	StyleStatusSynced   = lipgloss.NewStyle().Foreground(ColorGreen)
	StyleStatusAhead    = lipgloss.NewStyle().Foreground(ColorMauve)
	StyleStatusBehind   = lipgloss.NewStyle().Foreground(ColorYellow)
	StyleStatusDiverged = lipgloss.NewStyle().Foreground(ColorRed)
	StyleStatusUnknown  = lipgloss.NewStyle().Foreground(ColorSubtle)
)

Status styles.

View Source
var (
	StyleBold         = lipgloss.NewStyle().Bold(true)
	StyleDim          = StyleMuted
	StyleRowHighlight = lipgloss.NewStyle().Background(ColorSurface)
)

Text styles.

Functions

func CmdOpenURL

func CmdOpenURL(url string) tea.Cmd

CmdOpenURL opens a URL with the platform's default handler.

func HintCancelScroll

func HintCancelScroll() string

func HintChecklistConfirm

func HintChecklistConfirm() string

func HintDismiss

func HintDismiss() string

func HintDismissAndScroll added in v0.13.2

func HintDismissAndScroll() string

func HintSubmitCancel

func HintSubmitCancel() string

func JoinStatus

func JoinStatus(parts ...string) string

func MessageAborted

func MessageAborted(action string) string

func MessageClosed

func MessageClosed(target string) string

func MessageComplete

func MessageComplete(action string) string

func MessageNoOutput

func MessageNoOutput() string

func MessageOpening

func MessageOpening(target string) string

func OverlayBottomCenter added in v0.12.4

func OverlayBottomCenter(bg, fg string, screenW, y int) string

OverlayBottomCenter places fg horizontally centered at the given y coordinate.

func OverlayBottomRight added in v0.13.2

func OverlayBottomRight(bg, fg string, screenW int, screenH int) string

OverlayTopRight places fg against the bottom-right corner of bg (1px horizontal margin and 2px vertical margin)

func OverlayCenter

func OverlayCenter(bg, fg string, screenW, screenH int) string

func OverlayTopRight added in v0.13.2

func OverlayTopRight(bg, fg string, screenW int) string

OverlayBottomRight places fg against the top-right corner of bg (1px margin).

func PlaceOverlay

func PlaceOverlay(bg, fg string, x, y int) string

func RelativeTimeCompact added in v0.12.10

func RelativeTimeCompact(t time.Time) string

RelativeTimeCompact formats recent times for dense TUI tables, for example "2h ago", "3d ago", or "1wk 2d ago".

func RenderBadge added in v0.12.10

func RenderBadge(label string, variant BadgeVariant, nerd bool) string

RenderBadge returns a pill-shaped badge with a Catppuccin variant color theme.

func RenderButton

func RenderButton(label string, selected bool, nerd bool) string

RenderButton returns a styled button string. If selected, the button is highlighted (green, bold). If nerd is true, powerline rounded caps are added so the button looks like a pill.

func RenderChordOverlay added in v0.13.2

func RenderChordOverlay(prefix string, bindings []key.Binding) string

RenderChordOverlay renders a compact box listing the available chord completions for the given prefix key. The prefix is embedded in the top border and the "esc close" hint is right-aligned. Intended for placement in the top-right corner via OverlayTopRight.

func RenderFixedColumns added in v0.12.10

func RenderFixedColumns(cols []FixedColumn) string

RenderFixedColumns renders ANSI-safe fixed-width columns and joins them into one row. Each column is truncated and padded to its exact width.

func RenderInlineBindings

func RenderInlineBindings(bindings ...key.Binding) string

RenderInlineBindings renders compact "key description" hints for transient status lines and prompts.

func RenderModalFrame

func RenderModalFrame(opts ModalFrameOptions) string

func RenderPanelFrame

func RenderPanelFrame(opts PanelFrameOptions) string

func RenderRowHighlight added in v0.12.10

func RenderRowHighlight(text string) string

RenderRowHighlight applies the shared row highlight background and re-applies it after nested ANSI resets so per-cell foreground colors stay visible across the full row.

func StatusWithHints

func StatusWithHints(message string, hints ...key.Binding) string

Types

type BadgeVariant added in v0.12.10

type BadgeVariant string
const (
	BadgeVariantSurface BadgeVariant = "surface"
	BadgeVariantBlue    BadgeVariant = "blue"
	BadgeVariantGreen   BadgeVariant = "green"
	BadgeVariantYellow  BadgeVariant = "yellow"
	BadgeVariantOrange  BadgeVariant = "orange"
	BadgeVariantMauve   BadgeVariant = "mauve"
)

type ChordHinter added in v0.13.2

type ChordHinter interface {
	ChordHints(prefix string) []key.Binding
}

ChordHinter is implemented by models that expose chord completion hints. The app model queries the active child via this interface to combine app-level and child-level hints into one overlay.

type CommandOutput

type CommandOutput struct {
	Stdout string
	Stderr string
}

func (CommandOutput) String

func (o CommandOutput) String() string

type CommandOutputLog

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

func CommandOutputLogFrom

func CommandOutputLogFrom(output string) *CommandOutputLog

func NewCommandOutputLog

func NewCommandOutputLog() *CommandOutputLog

func (*CommandOutputLog) AppendCommand

func (l *CommandOutputLog) AppendCommand(name string, args []string, output string)

func (*CommandOutputLog) String

func (l *CommandOutputLog) String() string

type CommandOutputRecorder

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

func NewCommandOutputRecorder

func NewCommandOutputRecorder() *CommandOutputRecorder

func (*CommandOutputRecorder) Attach

func (r *CommandOutputRecorder) Attach(cmd *exec.Cmd)

func (*CommandOutputRecorder) Output

type FixedColumn added in v0.12.10

type FixedColumn struct {
	Text  string
	Width int
	Style lipgloss.Style
}

type IconSet

type IconSet struct {
	Check        string
	Close        string
	Dash         string
	Branch       string
	Worktree     string
	FolderClosed string
	FolderOpen   string
	FileModified string
	FileAdded    string
	FileDeleted  string
	FileRenamed  string
	FileSymlink  string
	Ahead        string
	Behind       string
	Search       string
	Partial      string
	Staged       string
}

IconSet provides semantic icon names with nerd-font and plain fallbacks.

func Icons

func Icons(useNerdFont bool) IconSet

type ModalFrameOptions

type ModalFrameOptions struct {
	Title           string
	RightTitle      string
	Body            string
	Hint            string
	Width           int
	BorderColor     color.Color
	TitleColor      color.Color
	RightTitleColor color.Color
	HintColor       color.Color
	PaddingX        int
	TitleInBorder   bool
}

type PanelFrameOptions

type PanelFrameOptions struct {
	Width       int
	Height      int
	Title       string
	RightTitle  string
	Lines       []string
	BorderColor color.Color
	TitleColor  color.Color
	Background  color.Color
}

type Terminal

type Terminal int

Terminal identifies the terminal multiplexer or emulator gx is running inside.

const (
	TerminalPlain       Terminal = iota // plain terminal, no multiplexer
	TerminalTmux                        // inside tmux ($TMUX set)
	TerminalKitty                       // inside kitty, no remote control ($KITTY_WINDOW_ID set)
	TerminalKittyRemote                 // inside kitty with remote control ($KITTY_LISTEN_ON set)
)

func DetectTerminal

func DetectTerminal() Terminal

DetectTerminal detects the current terminal environment from environment variables.

func DetectTerminalFrom

func DetectTerminalFrom(getenv func(string) string) Terminal

DetectTerminalFrom detects the terminal environment using the provided getter.

func (Terminal) CanSplit

func (t Terminal) CanSplit() bool

CanSplit reports whether gx can open a new split pane for git commit.

func (Terminal) String

func (t Terminal) String() string

String returns a short display label ("tmux", "kitty") or "" for plain terminals.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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