overhaul colour/ordering system for coherency

squash
This commit is contained in:
atagen 2024-12-04 14:28:40 +11:00
parent 0f82bd2dba
commit 3fc9c2e2c8
6 changed files with 90 additions and 38 deletions

View file

@ -1,13 +1,13 @@
open Processing
let read_all colours order =
let read_all colours =
In_channel.set_binary_mode stdin true;
let open Types in
let t = Emitter.create and culr = Culriser.create order [] colours in
let t = Emitter.create and culr = Culriser.create colours in
Emitter.serialise t (Ansi [ Fg (Culriser.next culr) ]);
Angstrom_unix.parse_many ~buf_size:4096 Parse.culr_parse
(fun c -> c |> ansi_filter |> Culriser.serialise_with_colour culr t)
stdin
|> function
| _, Ok _ -> Emitter.flush t
| _ -> ()
| _, Error e -> prerr_endline ("error encountered:" ^ e)