package ocolor

  1. Overview
  2. Docs
Print with style in your terminal using Format's semantic tags

Install

Dune Dependency

Authors

Maintainers

Sources

1.2.tar.gz
md5=28b04a0cd1b8bbec795fe098913dff9b
sha512=420b6fbd8d18eb8e326dd23910fab3ea691e5e5044cf531d958f6bcd5dabb223075c31269873c5c5e5e273b8e391c0cdc20296c1ba4568819888e44bfef150be

doc/ocolor/Ocolor_config/index.html

Module Ocolor_config

Configuration

Sometimes, default configuration does not suit you. We go through setters and getters rather than just giving access to the underlying ref in order to allow some operations in the future when changing the configuration. For instance, if we cache color conversion, we might want to clear the cache when the configuration is changed.

Please note that the configuration is not automatic. This library aims to be as pure as possible, and thus does not provide any mechanism, to detect the terminal settings.

type color_capability =
  1. | Color4
  2. | Color8
  3. | Color24

The kind of colors supported by the terminal. Except if done manually, every color will be encoded in the more expressible format possible. For instance, if the terminal support 8-bits colors, but the user try to print a 24-bits color, the result will be the clostest 8-bits color with respect to the distance in Lab color space

val get_separator : unit -> string

The separator used between each integer in SGR sequences. By default, this is ";". It should work in any terminal, but since it is not the only legal separator, it is configurable.

val set_separator : string -> unit

Change separator.

val get_palette : unit -> Ocolor_types.color_palette

The palette of the terminal. By default, this is Xterm. It should be ok.

val set_palette : Ocolor_types.color_palette -> unit

Change palette.

val get_color_capability : unit -> color_capability

The kind of colors the terminal can display. By default, this is Color24. Most of terminals can display 24-bits colors. Used to downgrade colors to 8- or 4- bits colors, with respect to the capability of the terminal

val set_color_capability : color_capability -> unit
val get_auto_reset : unit -> bool

Whether Printf-like functions reset the style after the print or not. Default to true. But, prefer the Format-like functions of Ocolor_format.

val set_auto_reset : bool -> unit

Change auto_reset.

OCaml

Innovation. Community. Security.

On This Page
  1. Configuration