Module Color_brewery
Colors palettes and functions to brew colors.
- version
- 0.2
val to_int : rgba -> intto_int cconverts the color to0xRRGGBBwhereRR,GGandBBare 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 -> rgbaof_int_exn ireturns the color provided as0xRRGGBB.- raises Invalid_argument
if
idoes not represent a color.
- parameter a
the transparency component of the color. Default:
0.
val of_int : ?a:float -> int -> rgba optionof_intis the similar toof_int_exnexcept that it returnsNoneinstead of raising an exception.
val to_string : rgba -> stringto_string cconverts the color to a string of the form #RRGGBB.
val to_gray : rgba -> rgbato_gray creturns 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 -> rgbahue hreturn the color corresponding to the hueh ∈ [0., 360.).
val hue_pct : float -> rgbahue hreturn the color corresponding to the hueh ∈ [0., 1.).
module Gradient : sig ... endval range : ?grad:Gradient.t -> n:int -> float -> float -> (float * rgba) listrange ~n a bgenerates a uniform sampling ofnpoints betweenaandb(with the boundsaandbincluded in the list of points) together with colors (based onhueat the moment).- parameter grad
generate colors using the given gradient. Default: use the hue.
val with_colors : ?grad:Gradient.t -> 'a list -> ('a * rgba) listwith_colors ladd 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 ... endColormaps with certain characteristics.