kitty

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 kitty encodes images as Kitty graphics protocol escape sequences with Unicode placeholders, so cell-based TUIs can treat an image as ordinary text. Supported by kitty and Ghostty.

Usage: write TransmitPNG then Place to the terminal once, and print the Placeholder text wherever the image should appear; the terminal draws the image over those cells. Write Delete when done.

Index

Constants

View Source
const MaxID = 0xFFFFFF

MaxID is the largest usable image id: placeholder cells encode the id in a 24-bit foreground color.

View Source
const MaxSpan = len(diacritics)

MaxSpan is the largest placement size, in rows or columns, addressable by placeholder diacritics.

Variables

This section is empty.

Functions

func Delete

func Delete(id uint32) []byte

Delete returns the escape sequence that removes the image's placements and frees its stored data.

func Place

func Place(id uint32, rows, cols int) ([]byte, error)

Place returns the escape sequence that creates a virtual (U=1) placement of the transmitted image, scaled to rows x cols cells. The placement renders wherever Placeholder text for the same id is printed.

func Placeholder

func Placeholder(id uint32, rows, cols int) (string, error)

Placeholder returns rows lines of placeholder cells for the image id. Each cell is U+10EEEE with diacritics naming its row and column and a foreground color encoding the id; the terminal draws the matching virtual placement over these cells wherever they appear. Every cell is fully addressed, so lines survive partial repaints and reordering.

func TransmitPNG

func TransmitPNG(id uint32, img image.Image) ([]byte, error)

TransmitPNG returns the escape sequences that upload img as PNG data under the given image id, without displaying it. The terminal replies nothing (q=2), so no reads are needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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