tui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tui provides a Bubble Tea component that shows a streakboard as a pixel image embedded in the layout, using the Kitty graphics protocol's Unicode placeholders (supported by Ghostty and kitty).

The board is ordinary text to Bubble Tea — placeholder cells the terminal overlays with the image — so it scrolls, moves, and composes like any other view content. GitHub-style month and weekday labels are composed around the image as plain dimmed text in the terminal's own font. The image bytes are sent out-of-band via tea.Raw commands; run the program on a TrueColor profile so the id-encoding placeholder colors are not downsampled.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is a Bubble Tea component displaying one streakboard. Create it with New, route Update messages to it, and place View's text anywhere in the layout.

func New

func New(entries []streakboard.Entry, o streakboard.Options) Model

New returns a board showing entries rendered with o's palette, scale, and max. o.From and o.To are ignored: the window always ends today and sizes itself to the terminal width, up to one year.

func (Model) Close

func (m Model) Close() tea.Cmd

Close returns the command that removes the board's image from the terminal; sequence it before tea.Quit.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Set

func (m Model) Set(entries []streakboard.Entry, o streakboard.Options) (Model, tea.Cmd)

Set replaces the board's data and options and re-uploads the image.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update resizes the board window; the first tea.WindowSizeMsg also triggers the initial image upload. Other messages are ignored.

func (Model) View

func (m Model) View() string

View returns the board as text: a month-name header line, then 7 placeholder lines — 2 cells per shown week, prefixed with a Mon/Wed/Fri gutter — that the terminal overlays with the image. It is empty until the first tea.WindowSizeMsg arrives.

Jump to

Keyboard shortcuts

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