Expand description
Kitty terminal graphics renderer.
Renders a ChartSpec to an RGB bitmap via plotters, encodes it as
PNG via the image crate, then wraps the PNG in kitty’s graphics
Application Programming Command (APC) escape sequence so the result
can be written directly to stdout inside a kitty-compatible terminal.
Protocol reference: https://sw.kovidgoyal.net/kitty/graphics-protocol/. Key choices:
f=100— the payload is PNG, not raw RGB. Lets the terminal decode via libpng without us having to specify pixel dimensions.a=T— transmit and display immediately at the cursor.m=1/m=0— chunking. The protocol caps each APC chunk at 4096 base64 characters; any more gets silently dropped.
Structs§
- Kitty
Opts - Dimensions, in pixels, for the rendered chart.
Functions§
- encode_
png_ apc - Encode PNG bytes as one or more kitty APC graphics commands. The
chunks share an implicit image ID; the final chunk sets
m=0to tell the terminal to display. - render_
kitty - Render
specto a PNG and return the kitty APC escape string that displays it at the current cursor. - render_
png - Render
specto a PNG byte vector. ReturnsNoneon any drawing or encoding failure; callers decide whether to substitute a text fallback.