tui

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BorderH  = "\u2500" // '─' - box drawings light horizontal
	BorderV  = "\u2502" // '│' - box drawings light vertical
	BorderTL = "\u256d" // '╭' - box drawings light arc down and right
	BorderTR = "\u256e" // '╮' - box drawings light arc down and left
	BorderBL = "\u2570" // '╰' - box drawings light arc up and right
	BorderBR = "\u256f" // '╯' - box drawings light arc up and left
	BorderML = "\u251c" // '├' - box drawings light vertical and right
	BorderMR = "\u2524" // '┤' - box drawings light vertical and left
	BorderMT = "\u252c" // '┬' - box drawings light down and horizontal
	BorderMB = "\u2534" // '┴' - box drawings light up and horizontal
	BorderX  = "\u253c" // '┼' - box drawings light cross
)

Box-drawing glyphs for panes, popups and any other framed content

View Source
const PlaceholderRune = kitty.Placeholder

PlaceholderRune is kitty's Unicode image placeholder

Variables

View Source
var (
	ColorReset        = Color{/* contains filtered or unexported fields */}
	ColorBlack        = Color{/* contains filtered or unexported fields */}
	ColorRed          = Color{/* contains filtered or unexported fields */}
	ColorGreen        = Color{/* contains filtered or unexported fields */}
	ColorYellow       = Color{/* contains filtered or unexported fields */}
	ColorBlue         = Color{/* contains filtered or unexported fields */}
	ColorMagenta      = Color{/* contains filtered or unexported fields */}
	ColorCyan         = Color{/* contains filtered or unexported fields */}
	ColorGray         = Color{/* contains filtered or unexported fields */}
	ColorLightRed     = Color{/* contains filtered or unexported fields */}
	ColorLightGreen   = Color{/* contains filtered or unexported fields */}
	ColorLightYellow  = Color{/* contains filtered or unexported fields */}
	ColorLightBlue    = Color{/* contains filtered or unexported fields */}
	ColorLightMagenta = Color{/* contains filtered or unexported fields */}
	ColorLightCyan    = Color{/* contains filtered or unexported fields */}
	ColorLightGray    = Color{/* contains filtered or unexported fields */}
	ColorWhite        = Color{/* contains filtered or unexported fields */}
)

Functions

func ASCIIString added in v0.2.0

func ASCIIString(ch rune) string

ASCIIString returns a single-character string for ch without allocating. ch must be printable ASCII: 0x20 (space) through 0x7e (tilde)

func PlaceholderSymbol

func PlaceholderSymbol(at geom.Point) string

PlaceholderSymbol builds the cell content for image row and column

Types

type Buffer

type Buffer struct {
	geom.Size
	// contains filtered or unexported fields
}

func NewBuffer

func NewBuffer(size geom.Size) *Buffer

NewBuffer returns a buffer of blank cells

func (*Buffer) Blit

func (b *Buffer) Blit(src *Buffer, at geom.Point)

Blit copies src's cells into b at offset at, clipped to b's bounds

func (*Buffer) Clear

func (b *Buffer) Clear()

Clear resets every cell to blank

func (*Buffer) Fill

func (b *Buffer) Fill(style Style)

Fill sets every cell in the buffer to a space with the given style

func (*Buffer) FillRange

func (b *Buffer) FillRange(p geom.Point, width int, style Style)

FillRange fills width cells with a space in the given style. A style with no background is transparent: each cell keeps its existing background so a pre-painted layer (ruler, cursorline) shows through

func (*Buffer) Get

func (b *Buffer) Get(p geom.Point) Cell

Get reads a cell, returning the zero cell outside the buffer

func (*Buffer) PatchBg

func (b *Buffer) PatchBg(p geom.Point, bg Color)

PatchBg sets only the background color of the cell at p, preserving its symbol and foreground. Used to overlay rulers behind already-rendered text

func (*Buffer) PatchBgRange

func (b *Buffer) PatchBgRange(p geom.Point, width int, bg Color)

PatchBgRange sets only the background color of width cells starting at p, preserving each cell's symbol and foreground. Used to overlay a row highlight behind already-rendered text

func (*Buffer) RenderToANSI

func (b *Buffer) RenderToANSI() string

RenderToANSI serializes the buffer as rows joined by '\n', emitting style escapes only on changes, used to bridge into the string-based render path

func (*Buffer) Set

func (b *Buffer) Set(p geom.Point, c Cell)

Set writes a cell, ignoring points outside the buffer

func (*Buffer) SetRightAlignedInt

func (b *Buffer) SetRightAlignedInt(args RightAlignedIntArgs)

SetRightAlignedInt writes Value as decimal digits right-aligned in a field of Width starting at At, padding left with spaces

func (*Buffer) SetString

func (b *Buffer) SetString(p geom.Point, s string, style Style)

SetString writes graphemes of s starting at p, advancing x by display width. A style with no background is transparent, keeping each cell's existing background

type Cell

type Cell struct {
	Symbol string
	Style  Style
	Skip   bool
}

type Color

type Color struct {
	// contains filtered or unexported fields
}

func ColorANSI added in v0.1.3

func ColorANSI(idx uint8) Color

ColorANSI returns the terminal color for an ANSI palette index

func ColorIndexed

func ColorIndexed(idx uint8) Color

ColorIndexed returns a color naming a 256-color palette entry

func ColorRGB

func ColorRGB(r, g, b uint8) Color

ColorRGB returns a 24-bit color

func ImageColor

func ImageColor(id uint32) Color

ImageColor encodes a 24-bit image id as a terminal color

func (Color) Darkened added in v0.1.15

func (c Color) Darkened(pct int) Color

Darkened scales the color toward black by pct/100 (pct<100 darkens). Reset stays reset; named and indexed colors resolve to rgb first

func (Color) IsReset

func (c Color) IsReset() bool

IsReset reports whether the color defers to the terminal default

func (Color) Quantized added in v0.1.35

func (c Color) Quantized() Color

Quantized returns the nearest 256-color palette entry, by true distance rather than the per-channel rounding a terminal library would apply

func (Color) RGBA added in v0.1.3

func (c Color) RGBA() (uint32, uint32, uint32, uint32)

RGBA returns the color's red, green, blue, and alpha values

type Modifier

type Modifier uint16
const (
	ModifierBold       Modifier = 0b0000_0000_0001
	ModifierDim        Modifier = 0b0000_0000_0010
	ModifierItalic     Modifier = 0b0000_0000_0100
	ModifierSlowBlink  Modifier = 0b0000_0001_0000
	ModifierRapidBlink Modifier = 0b0000_0010_0000
	ModifierReversed   Modifier = 0b0000_0100_0000
	ModifierHidden     Modifier = 0b0000_1000_0000
	ModifierCrossedOut Modifier = 0b0001_0000_0000
)

type RightAlignedIntArgs added in v0.2.0

type RightAlignedIntArgs struct {
	At    geom.Point
	Width int
	Value int
	Style Style
}

RightAlignedIntArgs is a number and the field it is right-aligned within

type Style

type Style struct {
	// contains filtered or unexported fields
}

func (Style) Bg

func (s Style) Bg(c Color) Style

Bg returns a copy with the background set

func (Style) BgColor

func (s Style) BgColor() Color

BgColor returns the style background color

func (Style) Darkened added in v0.1.15

func (s Style) Darkened(pct int) Style

Darkened darkens the foreground, background, and underline colors so an unfocused pane recedes

func (Style) Fg

func (s Style) Fg(c Color) Style

Fg returns a copy with the foreground set

func (Style) FgColor

func (s Style) FgColor() Color

FgColor returns the style foreground color

func (Style) HasMod

func (s Style) HasMod(m Modifier) bool

HasMod reports whether every bit in m is set

func (Style) Mod

func (s Style) Mod(m Modifier) Style

Mod returns a copy with the given modifier bits added

func (Style) Modifier

func (s Style) Modifier() Modifier

Modifier returns the style modifier bits

func (Style) Quantized added in v0.1.35

func (s Style) Quantized() Style

Quantized snaps the foreground, background, and underline colors onto the 256-color palette

func (Style) UlColor

func (s Style) UlColor(c Color) Style

UlColor returns a copy with the underline color set

func (Style) UlStyle

func (s Style) UlStyle(u UnderlineStyle) Style

UlStyle returns a copy with the underline variant set

func (Style) UnderlineColor

func (s Style) UnderlineColor() Color

UnderlineColor returns the style underline color

func (Style) UnderlineStyle

func (s Style) UnderlineStyle() UnderlineStyle

UnderlineStyle returns the style underline variant

type UnderlineStyle

type UnderlineStyle uint8
const (
	UnderlineReset UnderlineStyle = iota
	UnderlineLine
	UnderlineCurl
	UnderlineDotted
	UnderlineDashed
	UnderlineDoubleLine
)

Jump to

Keyboard shortcuts

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