package stk

  1. Overview
  2. Docs
On This Page
  1. Named colors
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Stk.ColorSource

Colors.

Sourcetype t = int32

A color is a int32, with bytes representing red, green, blue and alpha (opacity).

Sourceval compare : Int32.t -> Int32.t -> int
Sourceval pp : Format.formatter -> int32 -> unit
Sourceval to_int8s : int32 -> int * int * int * int

to_int8s color returns (red, green, blue, alpha) components of color.

Sourceval of_rgba : int -> int -> int -> int -> int32

of_rgba r g b a returns a color from the given components.

Sourceval of_rgba_0_1 : float -> float -> float -> float -> int32

of_rgba_0_1 r g b a returns a color from the given components as floats. Each component must be between 0. and 1. and is multiplicated by 255 to get the value on one byte for this component. Out of bounds values are corrected to be at least 0 and at most 255.

Sourceval sdl_color_of_int32 : int32 -> Tsdl.Sdl.color

sdl_color_of_int32 n creates a Tsdl.Sdl.color.

Sourceval of_hexa : string -> int32

Returns a color from a hexadecimal string representation. With each character being 0..9 or a|A..f|F, accepted forms are:

  • "rgb", mapped to (rr,gg,bb,FF),
  • "rgba", mapped to (rr,gg,bb,aa),
  • "rrggbb", mapped to (rr,gg,bb,FF),
  • any other string s which can be parsed by Int32.of_string ("0x"^s).

Raises Failure if the representation is invalid.

Sourceval transparent : int32

The transparent color.

Sourceval transparent_int8s : int * int * int * int

Transparent color as (r,g,b,a) bytes.

Sourceval transparent_color : Tsdl.Sdl.color

Transparent SDL color.

Named colors

Thes named colors corresponds to the SVG color specification.

Sourceval aliceblue : t
Sourceval antiquewhite : t
Sourceval aqua : t
Sourceval aquamarine : t
Sourceval azure : t
Sourceval beige : t
Sourceval bisque : t
Sourceval black : t
Sourceval blanchedalmond : t
Sourceval blue : t
Sourceval blueviolet : t
Sourceval brown : t
Sourceval burlywood : t
Sourceval cadetblue : t
Sourceval chartreuse : t
Sourceval chocolate : t
Sourceval coral : t
Sourceval cornflowerblue : t
Sourceval cornsilk : t
Sourceval crimson : t
Sourceval cyan : t
Sourceval darkblue : t
Sourceval darkcyan : t
Sourceval darkgoldenrod : t
Sourceval darkgray : t
Sourceval darkgreen : t
Sourceval darkgrey : t
Sourceval darkkhaki : t
Sourceval darkmagenta : t
Sourceval darkolivegreen : t
Sourceval darkorange : t
Sourceval darkorchid : t
Sourceval darkred : t
Sourceval darksalmon : t
Sourceval darkseagreen : t
Sourceval darkslateblue : t
Sourceval darkslategray : t
Sourceval darkslategrey : t
Sourceval darkturquoise : t
Sourceval darkviolet : t
Sourceval deeppink : t
Sourceval deepskyblue : t
Sourceval dimgray : t
Sourceval dimgrey : t
Sourceval dodgerblue : t
Sourceval firebrick : t
Sourceval floralwhite : t
Sourceval forestgreen : t
Sourceval fuchsia : t
Sourceval gainsboro : t
Sourceval ghostwhite : t
Sourceval gold : t
Sourceval goldenrod : t
Sourceval gray : t
Sourceval green : t
Sourceval greenyellow : t
Sourceval grey : t
Sourceval honeydew : t
Sourceval hotpink : t
Sourceval indianred : t
Sourceval indigo : t
Sourceval ivory : t
Sourceval khaki : t
Sourceval lavender : t
Sourceval lavenderblush : t
Sourceval lawngreen : t
Sourceval lemonchiffon : t
Sourceval lightblue : t
Sourceval lightcoral : t
Sourceval lightcyan : t
Sourceval lightgoldenrodyellow : t
Sourceval lightgray : t
Sourceval lightgreen : t
Sourceval lightgrey : t
Sourceval lightpink : t
Sourceval lightsalmon : t
Sourceval lightseagreen : t
Sourceval lightskyblue : t
Sourceval lightslategray : t
Sourceval lightslategrey : t
Sourceval lightsteelblue : t
Sourceval lightyellow : t
Sourceval lime : t
Sourceval limegreen : t
Sourceval linen : t
Sourceval magenta : t
Sourceval maroon : t
Sourceval mediumaquamarine : t
Sourceval mediumblue : t
Sourceval mediumorchid : t
Sourceval mediumpurple : t
Sourceval mediumseagreen : t
Sourceval mediumslateblue : t
Sourceval mediumspringgreen : t
Sourceval mediumturquoise : t
Sourceval mediumvioletred : t
Sourceval midnightblue : t
Sourceval mintcream : t
Sourceval mistyrose : t
Sourceval moccasin : t
Sourceval navajowhite : t
Sourceval navy : t
Sourceval oldlace : t
Sourceval olive : t
Sourceval olivedrab : t
Sourceval orange : t
Sourceval orangered : t
Sourceval orchid : t
Sourceval palegoldenrod : t
Sourceval palegreen : t
Sourceval paleturquoise : t
Sourceval palevioletred : t
Sourceval papayawhip : t
Sourceval peachpuff : t
Sourceval peru : t
Sourceval pink : t
Sourceval plum : t
Sourceval powderblue : t
Sourceval purple : t
Sourceval red : t
Sourceval rosybrown : t
Sourceval royalblue : t
Sourceval saddlebrown : t
Sourceval salmon : t
Sourceval sandybrown : t
Sourceval seagreen : t
Sourceval seashell : t
Sourceval sienna : t
Sourceval silver : t
Sourceval skyblue : t
Sourceval slateblue : t
Sourceval slategray : t
Sourceval slategrey : t
Sourceval snow : t
Sourceval springgreen : t
Sourceval steelblue : t
Sourceval tan : t
Sourceval teal : t
Sourceval thistle : t
Sourceval tomato : t
Sourceval turquoise : t
Sourceval violet : t
Sourceval wheat : t
Sourceval white : t
Sourceval whitesmoke : t
Sourceval yellow : t
Sourceval yellowgreen : t
Sourceval of_name : string -> t

of_name s returns the color associated to the given string (case-sensitive). Else, if s begin with '#', the rest of the string is parsed with of_hexa. If it fails or if the string does not start with '#', the black color is returned.

Sourceval named_colors : t list

The list of named colors.

Sourceval random : unit -> t

random () returns a random color from the list of named colors.

Sourceval ocf_wrapper : t Ocf.wrapper

Ocf.wrapper for a color.

OCaml

Innovation. Community. Security.