package stk
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=84927cce2b859a484df176163a68a21c
sha512=7d79d0b18c1550d59932ec27e5162f5ec5cfeb6560de32224cc7915f392e11d2c2fd94c44128b4b828b6ed700c2f079d120b2423874d71544e71bbab9253e870
doc/stk/Stk/Color/index.html
Module Stk.ColorSource
Colors.
A color is a int32, with bytes representing red, green, blue and alpha (opacity).
to_int8s color returns (red, green, blue, alpha) components of color.
of_rgba r g b a returns a color from the given components.
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.
to_sdl_color n creates a Tsdl.Sdl.color from a color.
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
swhich can be parsed byInt32.of_string ("0x"^s).
Raises Failure if the representation is invalid.
Transparent color as (r,g,b,a) bytes.
Transparent SDL color.
to_string c returns a string representation of color c in the form 0xhhhhhhhh (classical hexadecimal values for components red, green, blue and alpha). Optional parameter as_name (default:true) indicates if the name of the color must be returned rather than its hexadecimal representation, when a name is registered for this color (see register_color).
Registered colors
register_color name c registers color c with name so that it can be parsed (see of_string) and printed (see to_string using this name. If a color with the same name was already registered, a warning is issued and the new binding replaces the previous one. Same if another name was already associated to c.
registered () return the list of registered colors in the form (name, color).
Ocf.wrapper wrapper for a color.
Predefined colors
The following colors are already registered. These named colors corresponds to the SVG color specification.