ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinWidth    = 40
	MinHeight   = 12
	SkinnyWidth = 96 // below this, sidebar and help bar buttons are hidden

	SidebarRatio = 0.25
	MinSidebarW  = 48

	HeaderHeight   = 3
	ChannelHeaderH = 3 // channel name box above messages
	HelpHeight     = 3
	PaneGap        = 1 // gap between sidebar and message pane
	PaneTitleH     = 2 // title line + 1 blank line
)

Variables

View Source
var CurrentTheme = Theme{
	Primary:   lipgloss.Color("#D4A04A"),
	Secondary: lipgloss.Color("#5A5E6B"),
	Muted:     lipgloss.Color("#3E4250"),
	Accent:    lipgloss.Color("#E8B84B"),
	Text:      lipgloss.Color("#C8CCD4"),
	TextDim:   lipgloss.Color("#6B7080"),
	BgDark:    lipgloss.Color("#1A1C24"),
	Error:     lipgloss.Color("#E05252"),
	Success:   lipgloss.Color("#50C878"),
}

CurrentTheme is the active application theme.

Functions

func CreatePaneStyle

func CreatePaneStyle(isActive bool, width, height int) lipgloss.Style

CreatePaneStyle returns a bordered style for active or inactive panes.

func FillTerminal

func FillTerminal(content string, width, height int) string

FillTerminal places content centered in the terminal dimensions.

func FormatShortDateTime

func FormatShortDateTime(t time.Time) string

FormatShortDateTime formats a time in local timezone.

func LoadOmarchyTheme

func LoadOmarchyTheme() error

LoadOmarchyTheme reads the Omarchy system theme and applies it to CurrentTheme. Returns an error if the file cannot be found or parsed; callers should ignore the error to fall back to the default theme on non-Omarchy systems.

func RenderPaneTitle

func RenderPaneTitle(title string, isActive bool) string

RenderPaneTitle renders a pane title with theme styling.

func RenderSizeError

func RenderSizeError(minW, minH, curW, curH int) string

RenderSizeError renders a centered error box when the terminal is too small.

Types

type ButtonRegion

type ButtonRegion struct {
	Index int
	XMin  int
	XMax  int
}

ButtonRegion describes the horizontal hit area of a rendered button.

type ChatLayout

type ChatLayout struct {
	SidebarW int
	MessageW int
	ContentH int // Height available for sidebar and message pane
	HelpH    int
	TotalW   int
	TotalH   int
	Skinny   bool // true when terminal is too narrow for sidebar/help buttons
}

ChatLayout holds calculated dimensions for the chat UI.

func CalculateChatLayout

func CalculateChatLayout(termW, termH int) ChatLayout

CalculateChatLayout computes panel dimensions from terminal size.

func CalculateChatLayoutWithSidebar

func CalculateChatLayoutWithSidebar(termW, termH, sidebarOverride int) ChatLayout

CalculateChatLayoutWithSidebar computes panel dimensions with an optional sidebar width override. Pass 0 to use the default ratio-based calculation.

type KeyBinding

type KeyBinding struct {
	Key         string   // Display name (e.g., "Ctrl+j")
	Keys        []string // Actual key strings to match (e.g., "ctrl+j")
	Description string
}

KeyBinding represents a single key binding with its display info.

type KeyBindingSet

type KeyBindingSet struct {
	Bindings []KeyBinding
}

KeyBindingSet is an ordered collection of key bindings.

func (KeyBindingSet) ButtonRegions

func (kbs KeyBindingSet) ButtonRegions() []ButtonRegion

ButtonRegions returns the X start/end positions for each button in the rendered help bar. Used for mouse click hit testing.

func (KeyBindingSet) Contains

func (kbs KeyBindingSet) Contains(key string) *KeyBinding

Contains checks if a keypress string matches any binding in the set.

func (KeyBindingSet) Render

func (kbs KeyBindingSet) Render() string

Render formats the key binding set as bordered buttons.

type Theme

type Theme struct {
	Primary   color.Color // Active elements, selection
	Secondary color.Color // Borders, inactive text
	Muted     color.Color // Dimmed elements, help text
	Accent    color.Color // Unread indicators, alerts
	Text      color.Color // Primary text
	TextDim   color.Color // Secondary text
	BgDark    color.Color // Dark background areas
	Error     color.Color // Error states, recording, disconnected
	Success   color.Color // Success states, online indicators
}

Theme holds the application color palette and provides all style builders.

func (Theme) AccentStyle

func (t Theme) AccentStyle() lipgloss.Style

func (Theme) ActionButtonStyle

func (t Theme) ActionButtonStyle(width int) lipgloss.Style

func (Theme) ButtonStyle

func (t Theme) ButtonStyle() lipgloss.Style

func (Theme) ChannelHeaderStyle

func (t Theme) ChannelHeaderStyle(width, height int, borderColor color.Color) lipgloss.Style

func (Theme) ErrorStyle

func (t Theme) ErrorStyle() lipgloss.Style

func (Theme) HeaderStyle

func (t Theme) HeaderStyle(width int) lipgloss.Style

func (Theme) HeaderTitleStyle

func (t Theme) HeaderTitleStyle() lipgloss.Style

func (Theme) KeyDescStyle

func (t Theme) KeyDescStyle() lipgloss.Style

func (Theme) KeyStyle

func (t Theme) KeyStyle() lipgloss.Style

func (Theme) ListMentionStyle

func (t Theme) ListMentionStyle() lipgloss.Style

func (Theme) ListNormalStyle

func (t Theme) ListNormalStyle() lipgloss.Style

func (Theme) ListSelectedStyle

func (t Theme) ListSelectedStyle() lipgloss.Style

func (Theme) ListUnreadStyle

func (t Theme) ListUnreadStyle() lipgloss.Style

func (Theme) MentionCountStyle

func (t Theme) MentionCountStyle() lipgloss.Style

func (Theme) MentionDot

func (t Theme) MentionDot() string

func (Theme) MessageNameStyle

func (t Theme) MessageNameStyle() lipgloss.Style

func (Theme) MessageTimeStyle

func (t Theme) MessageTimeStyle() lipgloss.Style

func (Theme) ModalBoxStyle

func (t Theme) ModalBoxStyle(width int) lipgloss.Style

func (Theme) ModalHintStyle

func (t Theme) ModalHintStyle() lipgloss.Style

func (Theme) ModalLabelStyle

func (t Theme) ModalLabelStyle() lipgloss.Style

func (Theme) ModalTitleStyle

func (t Theme) ModalTitleStyle() lipgloss.Style

func (Theme) MutedStyle

func (t Theme) MutedStyle() lipgloss.Style

func (Theme) OfflineDot

func (t Theme) OfflineDot() string

func (Theme) OnlineDot

func (t Theme) OnlineDot() string

func (Theme) PrimaryStyle

func (t Theme) PrimaryStyle() lipgloss.Style

func (Theme) ScrollThumbStyle

func (t Theme) ScrollThumbStyle() lipgloss.Style

func (Theme) ScrollTrackStyle

func (t Theme) ScrollTrackStyle() lipgloss.Style

func (Theme) SecondaryStyle

func (t Theme) SecondaryStyle() lipgloss.Style

func (Theme) SuccessStyle

func (t Theme) SuccessStyle() lipgloss.Style

func (Theme) TabActiveStyle

func (t Theme) TabActiveStyle() lipgloss.Style

func (Theme) TabBaseStyle

func (t Theme) TabBaseStyle() lipgloss.Style

func (Theme) TabInactiveStyle

func (t Theme) TabInactiveStyle() lipgloss.Style

func (Theme) TextDimStyle

func (t Theme) TextDimStyle() lipgloss.Style

func (Theme) TextStyle

func (t Theme) TextStyle() lipgloss.Style

func (Theme) UnreadCountStyle

func (t Theme) UnreadCountStyle() lipgloss.Style

func (Theme) UnreadDot

func (t Theme) UnreadDot() string

Jump to

Keyboard shortcuts

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