pretty

package module
v0.0.6-38 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ANSI256

type ANSI256 uint8

type Align

type Align int
const (
	AlignLeft Align = iota
	AlignCenter
	AlignRight
)

type Basic

type Basic BasicColor

type BasicColor

type BasicColor int
const (
	Black BasicColor = iota
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
	BrightBlack
	BrightRed
	BrightGreen
	BrightYellow
	BrightBlue
	BrightMagenta
	BrightCyan
	BrightWhite
)

type Block

type Block struct {
	Segments []Segment
	Align    Align
	Style    Style
}

type Border

type Border struct {
	Chars BorderChars
	Style BorderStyle
}

type BorderChars

type BorderChars struct {
	Horizontal  rune
	Vertical    rune
	TopLeft     rune
	TopRight    rune
	BottomLeft  rune
	BottomRight rune
}

type BorderStyle

type BorderStyle struct {
	Color  Color
	Bold   bool
	Italic bool
}

func (BorderStyle) Base

func (s BorderStyle) Base() Style

type Box

type Box struct {
	Width    int
	SizeMode SizeMode
	MinWidth int

	PaddingX int
	PaddingY int
	MarginX  int
	MarginY  int

	Style  BoxStyle
	Border Border

	Blocks []Block
}

func NewAutoBox

func NewAutoBox() *Box

func NewBox

func NewBox(width int) *Box

func (*Box) AddBlock

func (box *Box) AddBlock(block Block)

func (*Box) Render

func (box *Box) Render() string

type BoxStyle

type BoxStyle struct {
	Background Color
}

func (BoxStyle) Base

func (s BoxStyle) Base() Style

type Color

type Color interface {
	// contains filtered or unexported methods
}

type Inline

type Inline interface {
	Width() int
	Render(base Style) string
}

type InlineSegment

type InlineSegment struct{ Items []Inline }

func (InlineSegment) Render

func (seg InlineSegment) Render(base Style, width int) []string

func (InlineSegment) Width

func (seg InlineSegment) Width() int

type RGB

type RGB struct {
	R, G, B uint8
}

func RGBColor

func RGBColor(r, g, b uint8) RGB

type Segment

type Segment interface {
	Width() int
	Render(base Style, width int) []string
}

type SizeMode

type SizeMode int
const (
	FixedWidth SizeMode = iota
	AutoWidth
)

type Span

type Span struct {
	Text  string
	Style Style
}

func (Span) Render

func (s Span) Render(base Style) string

func (Span) Width

func (s Span) Width() int

type Style

type Style struct {
	Foreground Color
	Background Color
	Bold       bool
	Italic     bool
}

func (Style) Combine

func (s1 Style) Combine(s2 Style) Style

type TextBlockSegment

type TextBlockSegment struct {
	Text  string
	Style Style
}

func (TextBlockSegment) Render

func (s TextBlockSegment) Render(base Style, width int) []string

func (TextBlockSegment) Width

func (s TextBlockSegment) Width() int

Jump to

Keyboard shortcuts

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