common

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package common holds shared types and styles used across TUI components.

Index

Constants

View Source
const Ellipsis = "\u2026"

Variables

View Source
var (
	DimStyle          = lipgloss.NewStyle().Foreground(lipgloss.Color("241"))
	HelpStyle         = lipgloss.NewStyle().Foreground(lipgloss.Color("246"))
	TextStyle         = lipgloss.NewStyle().Foreground(lipgloss.Color("252"))
	TextSelectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("62")).Bold(true)
	TitleStyle        = lipgloss.NewStyle().Foreground(lipgloss.Color("62")).Bold(true).Padding(0, 1)
	ErrorStyle        = lipgloss.NewStyle().Foreground(lipgloss.Color("9"))
)

Shared palette/UI styles

Functions

func ApplyTheme

func ApplyTheme(accent, text, dim, help lipgloss.Color)

ApplyTheme updates the shared styles to match the active theme. Call this from the tui package whenever the theme changes.

func TruncateDisplayWidth added in v0.9.2

func TruncateDisplayWidth(s string, maxCols int) string

TruncateDisplayWidth truncates s to at most maxCols display columns. Uses rune width so wide chars and zero-width runes are counted correctly.

func TruncateRunes added in v0.9.2

func TruncateRunes(s string, maxLen int) string

TruncateRunes truncates s to at most maxLen runes. Uses rune Good for title/label fields where display width is handled elsewhere.

Types

type Mode

type Mode int

Mode represents the current editing mode of a viewer tab.

const (
	ModeView Mode = iota
	ModeNormal
	ModeInsert
	ModeReplace
	ModeVisual
	ModeVisualLine
)

Viewer editing modes.

const ModeNone Mode = -1

ModeNone is default used by the cmdbar when no tab is active.

Jump to

Keyboard shortcuts

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