Module OgamlGraphics.Color

Color manipulation and creation

Submodules

HSV Manipulation of HSVA colors
RGB Manipulation of RGBA colors

This module provides an easy way to manipulate colors with different formats and to convert between them.

type t = [ `HSV of HSV.t | `RGB of RGB.t]
Polymorphic variant representing both color formats
See : OgamlGraphics.Color.HSV
See : OgamlGraphics.Color.RGB
val rgb_to_hsv : RGB.t -> HSV.t
Converts a color from RGB to HSV
See : OgamlGraphics.Color.HSV
See : OgamlGraphics.Color.RGB
val hsv_to_rgb : HSV.t -> RGB.t
Converts a color from HSV to RGB
See : OgamlGraphics.Color.HSV
See : OgamlGraphics.Color.RGB
val to_hsv : t -> HSV.t
Converts a color to HSV
See : OgamlGraphics.Color.HSV
val to_rgb : t -> RGB.t
Converts a color to RGB
See : OgamlGraphics.Color.RGB
val hsv : ?alpha:float -> float -> float -> float -> t
Fast way to create a HSV color
See : OgamlGraphics.Color.HSV
val rgb : ?alpha:float -> float -> float -> float -> t
Fast way to create a RGB color
See : OgamlGraphics.Color.RGB
val alpha : t -> float
Returns the alpha value of a color
val clamp : t -> t
Clamps a color w.r.t RGB.clamp and HSV.clamp
val map : t -> (float -> float) -> t
Maps each value of a color (assumed in RGB format)
val print : t -> string
Pretty-prints a color to a string