package ocolor

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

Install

Dune Dependency

Authors

Maintainers

Sources

1.3.1.tar.gz
md5=648a95f1829c7a26172e7168e969962d
sha512=f825b57889f4ca6f074688c736c26c98192d1bee37e05d81c991b6a75d4e06009656afe6430f55426e83e6a6922f791e5d8b7cccf56f908b940702bd21eebec9

doc/ocolor/Ocolor_config/index.html

Module Ocolor_configSource

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.

Sourcetype 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

Sourceval 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.

Sourceval set_separator : string -> unit

Change separator.

Sourceval get_palette : unit -> Ocolor_types.color_palette

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

Sourceval set_palette : Ocolor_types.color_palette -> unit

Change palette.

Sourceval 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

Sourceval set_color_capability : color_capability -> unit
Sourceval 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.

Sourceval set_auto_reset : bool -> unit

Change auto_reset.

OCaml

Innovation. Community. Security.

On This Page
  1. Configuration