On this page:
format-kitty-graphics-command
format-kitty-graphics-query
format-kitty-graphics-delete
format-kitty-graphics-delete-all
format-kitty-image
format-kitty-transmit
format-kitty-place
format-kitty-virtual-placement
format-kitty-delete-placement
format-kitty-feature-query
kitty-unicode-feature-reply?

8 Low-level formatters🔗ℹ

Byte-level helpers for applications that build their own APC commands. None of them write to the terminal; the put-* / kitty-* functions above call them.

procedure

(format-kitty-graphics-command control    
  payload) → (listof bytes?)
  control : string?
  payload : bytes?
Base64-encodes payload, splits it into 4096-byte chunks and returns one APC (ESC _ G ... ESC \) per chunk, with m=1 on every chunk but the last. control is prefixed to the first chunk; it must not contain m. An empty payload still produces one command.

procedure

(format-kitty-graphics-query) → (listof bytes?)

The recommended capability query (a 1x1 RGB image plus a=q).

procedure

(format-kitty-graphics-delete id) → (listof bytes?)

  id : exact-positive-integer?

procedure

(format-kitty-graphics-delete-all) → (listof bytes?)

Delete one image (d=I) or all images (d=A).

procedure

(format-kitty-image img 
  [#:cursor-move? cursor-move? 
  #:quiet? quiet?]) 
 → (listof bytes?)
  img : kitty-image?
  cursor-move? : boolean? = #f
  quiet? : boolean? = #t
Transmit-and-display (a=T). By default the cursor is not moved (C=1) and terminal replies are suppressed (q=2).

procedure

(format-kitty-transmit img [#:quiet? quiet?]) → (listof bytes?)

  img : kitty-image?
  quiet? : boolean? = #t
Transmit only (a=t), for later use with format-kitty-place.

procedure

(format-kitty-place image-id 
  placement-id 
  [#:columns columns 
  #:rows rows 
  #:x x 
  #:y y 
  #:z z 
  #:cursor-move? cursor-move? 
  #:quiet? quiet?]) 
 → (listof bytes?)
  image-id : exact-positive-integer?
  placement-id : (or/c exact-positive-integer? #f)
  columns : (or/c exact-positive-integer? #f) = #f
  rows : (or/c exact-positive-integer? #f) = #f
  x : (or/c exact-integer? #f) = #f
  y : (or/c exact-integer? #f) = #f
  z : (or/c exact-integer? #f) = #f
  cursor-move? : boolean? = #f
  quiet? : boolean? = #t
Place an already-transmitted image (a=p), optionally scaled to columnsxrows cells. placement-id may be #f to let the terminal assign one.

procedure

(format-kitty-virtual-placement image-id 
  placement-id 
  columns 
  rows 
  [#:quiet? quiet?]) 
 → (listof bytes?)
  image-id : exact-positive-integer?
  placement-id : (or/c exact-positive-integer? #f)
  columns : exact-positive-integer?
  rows : exact-positive-integer?
  quiet? : boolean? = #t
The invisible virtual placement (a=p,U=1) that Unicode placeholders refer to.

procedure

(format-kitty-delete-placement image-id 
  [#:placement-id placement-id]) 
 → (listof bytes?)
  image-id : exact-positive-integer?
  placement-id : (or/c exact-positive-integer? #f) = #f
Delete the placement(s) of one image while keeping its data (a=d,d=i).

The Unicode-placeholder feature query a=q,i=31,e=T,U=1.

procedure

(kitty-unicode-feature-reply? raw) → boolean?

  raw : bytes?
True when raw looks like a reply to format-kitty-feature-query (that is, it contains e=T and U=1).