tui

package
v28.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorTitle     = aec.NewBuilder(aec.DefaultF, aec.Bold).ANSI
	ColorPrimary   = aec.NewBuilder(aec.DefaultF, aec.Bold).ANSI
	ColorSecondary = aec.DefaultF
	ColorTertiary  = aec.NewBuilder(aec.DefaultF, aec.Faint).ANSI
	ColorLink      = aec.NewBuilder(aec.LightCyanF, aec.Underline).ANSI
	ColorWarning   = aec.LightYellowF
	ColorFlag      = aec.NewBuilder(aec.Bold).ANSI
	ColorNone      = aec.ANSI(noColor{})
)
View Source
var InfoHeader = Str{
	Plain: " Info -> ",
	Fancy: aec.Bold.Apply(aec.LightCyanB.Apply(aec.BlackF.Apply("i")) + " " + aec.LightCyanF.Apply("Info → ")),
}

Functions

func Chip

func Chip(fg, bg int, content string) string

func Ellipsis

func Ellipsis(s string, length int) string

Ellipsis truncates a string to a given number of runes with an ellipsis at the end. It tries to persist the ANSI escape sequences.

func Width

func Width(s string) int

Width returns the width of the string, ignoring ANSI escape codes. Not all ANSI escape codes are supported yet.

Types

type Output

type Output struct {
	*streams.Out
	// contains filtered or unexported fields
}

func NewOutput

func NewOutput(out *streams.Out) Output

func (Output) Color

func (o Output) Color(clr aec.ANSI) aec.ANSI

func (Output) Print

func (o Output) Print(p ...any)

func (Output) PrintNote

func (o Output) PrintNote(format string, args ...any)

func (Output) Println

func (o Output) Println(p ...any)

func (Output) PrintlnWithColor

func (o Output) PrintlnWithColor(clr aec.ANSI, args ...any)

func (Output) Sprint

func (o Output) Sprint(all ...any) string

type Str

type Str struct {
	// Fancy is the fancy string representation of the string.
	Fancy string

	// Plain is the plain string representation of the string.
	Plain string
}

func (Str) String

func (p Str) String(isTerminal bool) string

Jump to

Keyboard shortcuts

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