package color

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module ColorSource

This module deals with colors.

Sourcetype t

Representation of a color.

Sourcemodule Hsla : sig ... end
Sourcemodule Rgba' : sig ... end
Sourcemodule Rgba : sig ... end
Sourceval of_rgba : int -> int -> int -> float -> t

Creates a color from integer RGB values between 0 and 255 and a floating point alpha value between 0.0 and 1.0. Algorithm adapted from: https://en.wikipedia.org/wiki/HSL_and_HSV

Sourceval of_rgb : int -> int -> int -> t

Creates a color from RGB values between 0 and 255.

Sourceval of_rgba' : float -> float -> float -> float -> t

Creates a color from RGB and alpha values between 0.0 and 1.0

Sourceval of_rgb' : float -> float -> float -> t

Creates a color from RGB values between 0.0 and 1.0

Sourceval of_hsla : float -> float -> float -> float -> t

Creates a color from Hue, Saturation, Lightness and Alpha values. Hue is in degrees, a float value between 0.0 and 360.0. Saturation, Lightness and Alpha are float values between 0.0 and 1.0

Sourceval of_hsl : float -> float -> float -> t

Creates a color from Hue, Saturation and Lightness. Hue is in degrees, a float value between 0.0 and 360.0. Saturation and Lightness are float values between 0.0 and 1.0

Sourceval to_hsla : t -> Hsla.t

Converts a color to its Hue, Saturation, Lightness and Alpha values.

Sourceval to_rgba' : t -> Rgba'.t

Converts a color to its rgba value. All values are floats between 0.0 and 1.0

Sourceval to_rgba : t -> Rgba.t

Converts a color to its rgba value. RGB values are integers in the range of 0 to 255. The alpha channel is a float between 0.0 and 1.0

Sourceval to_hexstring : t -> string

Converts a color to its hexadecimal representation. The alpha channel is not represented.

OCaml

Innovation. Community. Security.