CSS.ColorAll about CSS colors. MDC documentation here: https://developer.mozilla.org/en/CSS/color_value . Specifications here: http://www.w3.org/TR/css3-color/#svg-color .
type name = The colors by name.
val string_of_name : name -> stringGives the string equivalent of the argument.
val rgb_of_name : name -> int * int * intConverts a color name into three integers representing the Red, Green and Blue channels. Channel values are in between 0 and 255.
Convert a tuple of three integers between 0 and 255 into a hex string
type t = | Name of name | (* A color by name *) |
| RGB of int * int * int | (* Red, Green and Blue values. Clipped to |
| RGB_percent of int * int * int | (* RBG channels are specified as a percentage of their maximal value. *) |
| RGBA of int * int * int * float | (* Same as RGB with additional transparency argument. Opacity should be between |
| RGBA_percent of int * int * int * float | (* RGB channels specified as percentage of their maximal value. Alpha channel (opacity) is still a |
| HSL of int * int * int | (* Hue, Saturation and Lightness values. Hue is an angle in degree (in interval |
| HSLA of int * int * int * float | (* Same as HSL with an opacity argument between |
The type of colors, either by name, by Red-Green-Blue constructor or by Hue-Saturation-Lightness constructors.
val rgb : ?a:float -> int -> int -> int -> tbuild a color from the values of red, green, and blue channels. optional a argument can be used to specify alpha channel (aka opacity).
val hsl : ?a:float -> int -> int -> int -> tbuild a color from the values of hue, saturation, and lightness channels. optional a argument can be used to specify alpha channel (aka opacity).
type js_t = private Js.js_string Js.tA js_t is a valid string representation of a CSS color
A few conversion functions
val string_of_t : t -> stringConvert to a string representation (for debugging purpose mainly).
Projection from OCaml to Js. js c is equivalent to Js.string (string_of_t c) but with a js_t return type.
val js_t_of_js_string : Js.js_string Js.t -> js_tChecks the well-formedness of a string or fails with Invalid_argument