Kitty Graphics Protocol in OCaml
terminal
graphics
ocaml
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(* Kitty Graphics Protocol Detection - Implementation *)
7
8let make_query () =
9 let cmd =
10 Kgp_command.query ~format:`Rgb24 ~transmission:`Direct ~width:1 ~height:1 ()
11 in
12 Kgp_command.to_string cmd ~data:"\x00\x00\x00"
13
14let supports_graphics response ~da1_received =
15 response
16 |> Option.map Kgp_response.is_ok
17 |> Option.value ~default:(not da1_received)