package notty-community
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=b8cb51edb37d28d9d53e98ac52848677
sha512=8922a190a412790285603ba7ab37f9f58202d9406ebc9e6d3329189eac7fda5c25316264c27b6f7decb8f25f0d78801873b9f16c40e90f020e2c06ab9d058686
Description
Notty is a declarative terminal library for OCaml structured around a notion of composable images. It tries to abstract away the basic terminal programming model, providing something simpler and more expressive.
This is a branch from the original notty, maintained by the community.
Published: 09 Oct 2025
README
Notty — Declaring terminals
Notty is a declarative terminal library for OCaml structured around a notion of composable images. It tries to abstract away the basic terminal programming model, providing something simpler and more expressive.
The core layout engine and IO codecs are pure platform-independent OCaml. Distribution includes modules with input and output facilities for Unix, and Lwt on Unix.
As an attempt to redefine terminal programming, Notty has to be opinionated. It assumes Unicode throughout, does not have universal support for various terminals out there, and has a peculiar programming and rendering model.
Notty's core API was heavily influenced by Haskell's Vty.
Where to start
Check out the documentation, examples, or peek directly into the interface file.
Building with dune build @ex
will produce several little example programs that also double as tests.
(* Game of Life with ZX Spectrum kitsch. *)
let dot : image = I.uchar A.(fg lightred) (Uchar.of_int 0x25cf) 1 1
let background step (n, m) =
let k = 24. *. sin (float (step + m + n) /. 10.) |> truncate in
if k > 0 then I.char A.(fg (gray k)) '.' 1 1 else I.void 1 1
let render (w, h) step life : image =
I.tabulate w (h - 1) @@ fun x y ->
let pt = (x, y) in
if CSet.mem pt life then dot else background step pt
What?
Notty?
Terminals are tedious to program for. Notty tries to abstract the tedium away, leaving you with a more pleasant programming surface that's quite unlike a TTY. Hence, No-TTY.
A new kind of Rust terminal?
This Notty has no connection to any other body of code named Notty.
Why make yet another terminal output library?
Because:
- It allows one to describe what should be seen, as opposed to commanding a terminal.
- It's pretty compact. Both bells and whistles can be implemented separately.
- Core is easy to glue onto various IO backends.
- Pure platform-independent OCaml.