val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val compare : t -> t -> int
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.state
val hash : t -> Base.Hash.hash_value
val equal : t -> t -> bool
val to_int : t -> int
val of_int_exn : int -> t
val of_rgb6_exn : (int * int * int) -> t
Takes an RGB triple with values in the range
0,5
(inclusive) and returns the appropriate 256-color palette value. Will throw an exception if any of the inputs are out-of-range. Note that the input values are weighted as described above.
val of_rgb : (float * float * float) -> t
Takes an RGB triple with float values in the closed (inclusive) interval
0,1
and returns the nearest (rounded) 256-color palette value. Out-of-bound values are clamped to the range. The inputs are not weighted, unlikeof_rgb6_exn
as described above.
val of_rgb_8bit : (int * int * int) -> t
Takes an RGB triple with integer values in the closed (inclusive) range
0,255
and returns the nearest (rounded) 256-color palette color-cube value. Out-of-bound values are clamped to the range. The inputs are not weighted, unlikeof_rgb6_exn
as described above.
val of_rgb_int1k : (int * int * int) -> t
Takes an RGB triple with integer values in the closed (inclusive) range
0,1000
and returns the nearest (rounded) 256-color palette color-cube value. Out-of-bound values are clamped to the range. The inputs are not weighted, unlikeof_rgb6_exn
as described above.
val of_gray24_exn : int -> t
Takes a grayscale level from
0-23
(inclusive, not-black-to-not-white) and returns the appropriate 256-color palette value. Will throw an exception if the input value is out-of-range.
val to_rgb : t -> [> `Primary of int | `RGB of float * float * float ]
Takes a color palette value and returns, for color-cube and grayscale palette values, an approximated
`RGB
triple with each component in the range0,1
; for the first 16 values,`Primary
followed by the specific palette index is returned, as these are not consistently defined.
val to_rgb_hex24 : t -> string
Takes a color palette value and returns a hex-encoded RGB 24-bit triplet, with a leading '#'. I.e. "#000000" through "#ffffff". The values returned for the first 16 (primary) colors follow the Windows Console scheme, as documented here: https://en.wikipedia.org/wiki/ANSI_escape_code .
val to_luma : t -> float
Takes a color palette value and returns an approximate luminance value in the closed interval
0,1
.
val to_rgb_8bit : t -> int * int * int
Takes a color palette value and returns a triple of RGB integers in the closed interval
0,255
.
val to_rgb_int1k : t -> int * int * int
Takes a color palette value and returns a triple of RGB integers in the closed interval
0,1000
.
val to_rgb6 : t -> int * int * int
Takes a color palette value and returns a triple of RGB integers in the closed interval
0,5
. For color-cube palette values, this simply un-doesof_rgb6_exn
. For others, it will return the closest matching value in the color-cube.