style

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Yellow     = "178"
	Orange     = "166"
	DarkOrange = "136"
)
View Source
const BoxChrome = 4

BoxChrome is the horizontal space the border itself eats: "│ " + content + " │". Callers sizing a box against the terminal subtract this from the available columns.

Variables

View Source
var (
	QuestionIcon    = lipgloss.NewStyle().Foreground(lipgloss.Color("251")).SetString("? ").Bold(true)
	CrossIcon       = lipgloss.NewStyle().Foreground(lipgloss.Color("9")).SetString("✗ ").Bold(true)
	TickIcon        = lipgloss.NewStyle().Foreground(lipgloss.Color(Yellow)).SetString("✓ ").Bold(true)
	TodoIcon        = lipgloss.NewStyle().SetString("• ").Bold(true)
	DoubleRightIcon = lipgloss.NewStyle().Foreground(lipgloss.Color("251")).SetString("» ").Bold(true)
	ChevronIcon     = lipgloss.NewStyle().Foreground(lipgloss.Color("251")).SetString("› ").Bold(true)
)
View Source
var Container = lipgloss.NewStyle().Border(lipgloss.NormalBorder()).Padding(1,
	2).BorderForeground(lipgloss.Color("#ff8c00"))

Functions

func ForegroundPrint

func ForegroundPrint(text string, color string) string

func MultiSectionBox

func MultiSectionBox(sections []Section) string

MultiSectionBox renders every section inside ONE continuous bordered box instead of one per section: the first title sits on the top border, later ones on a divider line (`├─ Title ──┤`) instead of their own top+bottom border. The box width fits the widest title/body line across all sections, so later sections can widen the whole box on the next render.

func MultiSectionBoxOpts

func MultiSectionBoxOpts(sections []Section, opts BoxOpts) (string, int)

MultiSectionBoxOpts renders sections per opts and reports the inner width it settled on, so a caller splitting one box across several renders can pass that width back in and keep the pieces aligned.

func ProgressBar

func ProgressBar(percent int) string

ProgressBar renders a fixed-width filled/empty block bar plus a right-aligned percentage, e.g. "████████░░░░░░░░░░░░░░░░ 42%".

Types

type BoxOpts

type BoxOpts struct {
	// MaxWidth clamps the box's total width, borders included. 0 means the
	// content decides. A box wider than the terminal gets hard-truncated by
	// bubbletea's renderer, which eats the right border off the long rows and
	// hides the tail of whatever error produced them.
	MaxWidth int
	// InnerWidth forces the content width instead of deriving it from the
	// widest line. Keeps every piece of a split box the same width, since
	// pieces already in scrollback can't be re-rendered.
	InnerWidth int
	// Continued opens with a "├─ Title ─┤" divider instead of a "╭" corner,
	// because earlier sections were already printed above.
	Continued bool
	// Open omits the closing "╰──╯" because more sections follow below.
	Open bool
}

BoxOpts tunes MultiSectionBoxOpts for a box rendered in pieces (see phasebox.Model, which commits finished sections to scrollback and keeps only the live one in the frame).

type Section

type Section struct {
	Title string
	Body  string
}

Section is one titled region of a MultiSectionBox: a title and its body (may be multi-line, may already carry its own ANSI styling — e.g. a colored icon — which is left untouched).

Jump to

Keyboard shortcuts

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