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, and look of 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_
png - Render
specto an RGBA PNG byte vector: opaque overopts.background, or transparent when there is none. ReturnsNoneon any drawing or encoding failure; callers decide whether to substitute a text fallback.