This module contains a few types and values to ease the use of CSS properties and such. If you think a feature is missing, consider sending a patch or an RFE to the mailing list.
This module contain submodules each with a signature similar to: type t (*type the module is focused on*) type js_t (*valid js representation of values of type t*) val js: t -> js_t (*conversion*) val ml: js_t -> t (*conversion*)
Additional functions (string conversion, standard operation, etc.) are sometime available. Some module have several different types instead of just one.
All 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 .
#
| Aliceblue
| |||
#
| Antiquewhite
| |||
#
| Aqua
| |||
#
| Aquamarine
| |||
#
| Azure
| |||
#
| Beige
| |||
#
| Bisque
| |||
#
| Black
| |||
#
| Blanchedalmond
| |||
#
| Blue
| |||
#
| Blueviolet
| |||
#
| Brown
| |||
#
| Burlywood
| |||
#
| Cadetblue
| |||
#
| Chartreuse
| |||
#
| Chocolate
| |||
#
| Coral
| |||
#
| Cornflowerblue
| |||
#
| Cornsilk
| |||
#
| Crimson
| |||
#
| Cyan
| |||
#
| Darkblue
| |||
#
| Darkcyan
| |||
#
| Darkgoldenrod
| |||
#
| Darkgray
| |||
#
| Darkgreen
| |||
#
| Darkgrey
| |||
#
| Darkkhaki
| |||
#
| Darkmagenta
| |||
#
| Darkolivegreen
| |||
#
| Darkorange
| |||
#
| Darkorchid
| |||
#
| Darkred
| |||
#
| Darksalmon
| |||
#
| Darkseagreen
| |||
#
| Darkslateblue
| |||
#
| Darkslategray
| |||
#
| Darkslategrey
| |||
#
| Darkturquoise
| |||
#
| Darkviolet
| |||
#
| Deeppink
| |||
#
| Deepskyblue
| |||
#
| Dimgray
| |||
#
| Dimgrey
| |||
#
| Dodgerblue
| |||
#
| Firebrick
| |||
#
| Floralwhite
| |||
#
| Forestgreen
| |||
#
| Fuchsia
| |||
#
| Gainsboro
| |||
#
| Ghostwhite
| |||
#
| Gold
| |||
#
| Goldenrod
| |||
#
| Gray
| |||
#
| Grey
| |||
#
| Green
| |||
#
| Greenyellow
| |||
#
| Honeydew
| |||
#
| Hotpink
| |||
#
| Indianred
| |||
#
| Indigo
| |||
#
| Ivory
| |||
#
| Khaki
| |||
#
| Lavender
| |||
#
| Lavenderblush
| |||
#
| Lawngreen
| |||
#
| Lemonchiffon
| |||
#
| Lightblue
| |||
#
| Lightcoral
| |||
#
| Lightcyan
| |||
#
| Lightgoldenrodyellow
| |||
#
| Lightgray
| |||
#
| Lightgreen
| |||
#
| Lightgrey
| |||
#
| Lightpink
| |||
#
| Lightsalmon
| |||
#
| Lightseagreen
| |||
#
| Lightskyblue
| |||
#
| Lightslategray
| |||
#
| Lightslategrey
| |||
#
| Lightsteelblue
| |||
#
| Lightyellow
| |||
#
| Lime
| |||
#
| Limegreen
| |||
#
| Linen
| |||
#
| Magenta
| |||
#
| Maroon
| |||
#
| Mediumaquamarine
| |||
#
| Mediumblue
| |||
#
| Mediumorchid
| |||
#
| Mediumpurple
| |||
#
| Mediumseagreen
| |||
#
| Mediumslateblue
| |||
#
| Mediumspringgreen
| |||
#
| Mediumturquoise
| |||
#
| Mediumvioletred
| |||
#
| Midnightblue
| |||
#
| Mintcream
| |||
#
| Mistyrose
| |||
#
| Moccasin
| |||
#
| Oldlace
| |||
#
| Olive
| |||
#
| Olivedrab
| |||
#
| Orange
| |||
#
| Orangered
| |||
#
| Orchid
| |||
#
| Palegoldenrod
| |||
#
| Palegreen
| |||
#
| Paleturquoise
| |||
#
| Palevioletred
| |||
#
| Papayawhip
| |||
#
| Peachpuff
| |||
#
| Peru
| |||
#
| Pink
| |||
#
| Plum
| |||
#
| Powderblue
| |||
#
| Purple
| |||
#
| Red
| |||
#
| Rosybrown
| |||
#
| Royalblue
| |||
#
| Saddlebrown
| |||
#
| Salmon
| |||
#
| Sandybrown
| |||
#
| Seagreen
| |||
#
| Seashell
| |||
#
| Sienna
| |||
#
| Silver
| |||
#
| Skyblue
| |||
#
| Slateblue
| |||
#
| Slategray
| |||
#
| Slategrey
| |||
#
| Snow
| |||
#
| Springgreen
| |||
#
| Steelblue
| |||
#
| Tan
| |||
#
| Teal
| |||
#
| Thistle
| |||
#
| Tomato
| |||
#
| Turquoise
| |||
#
| Violet
| |||
#
| Wheat
| |||
#
| White
| |||
#
| Whitesmoke
| |||
#
| Yellow
| |||
#
| Yellowgreen
|
The colors by name.
Converts a color name into three integers representing the Red, Green and
Blue channels. Channel values are in between 0
and 255
.
(* | A color by name | *) | |
#
| RGB of (int * int * int)
| (* | Red, Green and Blue values. Clipped to 0..255 by most (All?)
browsers. | *) |
#
| 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 additionnal transparency argument. Opacity should be
between 0. (completely transparent) and 1. (completely opaque). | *) |
#
| RGBA_percent of (int * int * int * float)
| (* | RGB channels specified as percentage of their maximal value. Alpha
channel (opacity) is still a 0. to 1. float. | *) |
#
| HSL of (int * int * int)
| (* | Hue, Saturation and Lightness values. Hue is an angle in degree (in
interval 0..360 ). Saturation is a percentage (0..100 ) with 0
being colorless. Lightness is also a percentage (0..100 ) with 0
being black. | *) |
#
| HSLA of (int * int * int * float)
| (* | Same as HSL with an opacity argument between 0. and 1. . | *) |
The type of colors, either by name, by Red-Green-Blue constructor or by Hue-Saturation-Lightness constructors.
build a color from the values of red, green, and blue channels. optional a
argument can be used to specify alpha channel (aka opacity).
build a color from the values of hue, saturation, and lightness channels.
optional a
argument can be used to specify alpha channel (aka opacity).
A few conversion functions
#
| Zero
| (* | For 0, unit is optional | *) |
#
| Em of float
| (* | Relative to the font size | *) |
#
| Ex of float
| (* | Relative to the x-height | *) |
#
| Px of float
| (* | Relative to the viewing device | *) |
#
| Gd of float
| (* | Relative to the grid | *) |
#
| Rem of float
| (* | Relative to the font size of the root | *) |
#
| Vw of float
| (* | Relative to the viewport's width | *) |
#
| Vh of float
| (* | Relative to the viewport's height | *) |
#
| Vm of float
| (* | Relative to the smallest of the viewport's width or height | *) |
#
| Ch of float
| (* | Relative to the width of a char '0' | *) |
#
| Mm of float
| (* | in Milimeter | *) |
#
| Cm of float
| (* | in Centimeter | *) |
#
| In of float
| (* | in Inch | *) |
#
| Pt of float
| (* | in Points (72pt = 1in) | *) |
#
| Pc of float
| (* | in Picas (1pc = 12pt) | *) |
The type of length attributes. Mdc documentation: https://developer.mozilla.org/en/CSS/length and specification: http://www.w3.org/TR/css3-values/#lengths
Conversion functions