ui

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 4 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedTags = supportedTagsRegexp()

SupportedTags is a regexp matching all supported markup tags.

Functions

func Blue

func Blue(text string) string

Blue styles the given text blue.

func Cyan

func Cyan(text string) string

Cyan styles the given text cyan.

func Red

func Red(text string) string

Red styles the given text red.

func RenderMarkup added in v0.12.0

func RenderMarkup(s string) string

RenderMarkup converts markup-tagged strings to lipgloss-styled strings. Tags like <white>, <blue>, <b> are converted to ANSI-styled text. Tags stack: <b><darkgrey> produces bold + darkgrey foreground. The </> tag (or any closing tag) resets all styles.

func RenderMarkupWithBase added in v0.12.0

func RenderMarkupWithBase(s string, base lipgloss.Style) string

RenderMarkupWithBase renders markup with a persistent base style. When tags are reset with </>, the style reverts to base rather than to an empty style. This preserves background colors through resets, avoiding ANSI nesting issues (e.g. footer text on a colored background).

func Tokenize

func Tokenize(str string, regex *regexp.Regexp) []string

Tokenize splits the string by tag matches, including the tags themselves.

func White

func White(text string) string

White styles the given text white.

func Yellow

func Yellow(text string) string

Yellow styles the given text yellow.

Types

type Theme added in v0.12.0

type Theme struct {
	// Base
	Fg     color.Color
	Bg     color.Color
	DarkBg color.Color

	// Text hierarchy
	FgMuted  color.Color // secondary text
	FgSubtle color.Color // de-emphasized text

	// Accents
	Primary   color.Color // main accent (selection, focus)
	Secondary color.Color // secondary accent
	Tertiary  color.Color // tertiary accent

	// Semantic
	Info    color.Color
	Success color.Color
	Error   color.Color
	Warning color.Color

	// UI elements
	Key          color.Color // labels, key hints
	Prompt       color.Color
	Border       color.Color // borders, separators
	Header       color.Color
	Footer       color.Color
	CursorLineBg color.Color
}

Theme defines the color palette for the application.

Jump to

Keyboard shortcuts

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