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.
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.
val rgb : int -> int -> int -> t
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
val hex : string -> t
hex s is the RGB24 colour given by the hex triplet
s, which must start with
rgb 0xFF 0x8C 0x00
rgb 0xFF 0xAA 0x00
Invalid_argument if the given string is not a
#-prefixed hex triplet.