package terminal
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=8be449553379bb2dc5e8b79805c80447690a03dca3e9aee959fecf46d8278fb7
sha512=841383e8aa7d6bd802ced5eb7feae01bd507b2914eb45e8a559140677f83d5b8ec614f1d0bc54421021b5254a1edd78dd8a2506b2dfb264af72448d76bd03ac5
doc/terminal.ansi/Terminal_ansi/Color/index.html
Module Terminal_ansi.Color
Source
The type of colours that can be rendered to a terminal.
4-bit ANSI colours
Colours built using ansi
will be rendered using the standard 4-bit ANSI escape codes for terminals. The actual colours displayed to the user depend on their terminal configuration / theme, ensuring that they look natural in context.
24-bit RGB colours
Most modern terminals offer support for full 24-bit RGB colour (called "true colour") in addition to the 16 original ANSI colours. These colours are rendered exactly as requested, offering greater flexibility at the risk of clashing with the user's theming.
rgb r g b
is the RGB24 colour with the given red, green and blue colour components respectively. Raises Invalid_argument
if any of the components are outside the range [0, 255]
.
hex s
is the RGB24 colour given by the hex triplet s
, which must start with #
. Examples:
hex "#FF8C00"
=rgb 0xFF 0x8C 0x00
hex "#fa0"
=rgb 0xFF 0xAA 0x00
Raises Invalid_argument
if the given string is not a #
-prefixed hex triplet.
Pretty-print a colour with an unspecified format.