package console

Build not yet checked
  1. Overview
  2. Docs
Colours, tables, trees and progress rows for the terminal

Install

dune-project
 Dependency

Authors

Maintainers

Sources

console-0.10.1.tbz
sha256=37ad65f6833c65814b0673f009f6b656c5194608ca03519da2e63e1051d54f6e
sha512=7677067f1a3244779cdbc5c90a8b0e1eba30c3fd58281584ea3d4c46c3e219eef0668588ca0e2938799c61a3fa831ce2146eac73717214d7baf96b497bfcd892

doc/src/console.tty/console_tty.ml.html

Source file console_tty.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(*---------------------------------------------------------------------------
  Copyright (c) 2026 Thomas Gazagnaire. All rights reserved.
  SPDX-License-Identifier: ISC
  ---------------------------------------------------------------------------*)

let outputs = [ (Fmt.stdout, Unix.stdout); (Fmt.stderr, Unix.stderr) ]

let setup ?style_renderer ?utf_8 ?theme () =
  Option.iter Console.Theme.set_program theme;
  List.iter
    (fun (ppf, fd) ->
      Console.Env.setup ?style_renderer ?utf_8 ~is_tty:(Unix.isatty fd) ppf)
    outputs;
  ignore (Recording.start ~time:(fun () -> 0.) Fmt.stdout : bool)

let ensure () =
  List.iter
    (fun (ppf, fd) -> Console.Env.ensure ~is_tty:(Unix.isatty fd) ppf)
    outputs

let is_terminal = Terminal.is_terminal
let size = Terminal.size
let width = Terminal.width_of