Module Color_brewery
Colors palettes and functions to brew colors.
- version
- 0.2
val to_int : rgba -> int
to_int c
converts the color to0xRRGGBB
whereRR
,GG
andBB
are the red, green and blue values expressed on 2 hexadecimal digits. The alpha value is ignored. This is convenient to interact, say, with the Graphics module.
val of_int_exn : ?a:float -> int -> rgba
of_int_exn i
returns the color provided as0xRRGGBB
.- raises Invalid_argument
if
i
does not represent a color.
- parameter a
the transparency component of the color. Default:
0.
val of_int : ?a:float -> int -> rgba option
of_int
is the similar toof_int_exn
except that it returnsNone
instead of raising an exception.
val to_string : rgba -> string
to_string c
converts the color to a string of the form #RRGGBB.
val to_gray : rgba -> rgba
to_gray c
returns the grayscale color corresponding toc
. It is a weighted sum of RGB Rec. ITU-R T.601-70.299 r + 0.587 g + 0.114 b
.
“Continuous” color ranges
val hue : float -> rgba
hue h
return the color corresponding to the hueh ∈ [0., 360.)
.
val hue_pct : float -> rgba
hue h
return the color corresponding to the hueh ∈ [0., 1.)
.
module Gradient : sig ... end
val range : ?grad:Gradient.t -> n:int -> float -> float -> (float * rgba) list
range ~n a b
generates a uniform sampling ofn
points betweena
andb
(with the boundsa
andb
included in the list of points) together with colors (based onhue
at the moment).- parameter grad
generate colors using the given gradient. Default: use the hue.
val with_colors : ?grad:Gradient.t -> 'a list -> ('a * rgba) list
with_colors l
add a color range to the listl
.- parameter grad
generate colors using the given gradient. Default: use the hue.
Color palettes (aka colormaps)
module Palette : sig ... end
Colormaps with certain characteristics.