termtab-0.1.0.0: TUI guitar tablature and score editor
Safe HaskellNone
LanguageGHC2021

Termtab.Graphics.KittyPlacement

Description

Kitty Unicode placeholder support.

The Kitty graphics protocol can display a "virtual" image (transmitted with U=1, see Termtab.Graphics.Kitty.encodeVirtual) through ordinary terminal cells, which is what lets an image live inside a cell-based TUI like brick/vty.

Each placeholder cell holds the placeholder code point U+10EEEE. The image id is carried in the cell's foreground color, and the cell's (row, column) within the image is carried by combining diacritics appended to the placeholder character. Kitty auto-increments the column for bare placeholder cells, so we only need to stamp the row (and column 0) on the first cell of each line.

Synopsis

Documentation

placeholderChar :: Char Source #

The Kitty image-placeholder code point.

rowColumnDiacritics :: [Char] Source #

Prefix of Kitty's rowcolumn diacritic table: rowColumnDiacritics !! n is the combining character that encodes the value n. This prefix covers the row counts we need (staff height in cells).

placeholderRows :: Int -> Int -> [String] Source #

Placeholder cell text for a cols×rows image grid, one String per row. The first cell of each row carries the row diacritic and column-0 diacritic; the remaining cells are bare placeholders whose columns Kitty auto-increments. All cells must be drawn with foregroundIdSGR as their foreground color.

foregroundIdSGR :: Int -> String Source #

Truecolor SGR that stores the image id in the foreground color (Kitty reads the 24-bit value as the id). Not visible — the placeholder shows image pixels.