package graphv_webgl

  1. Overview
  2. Docs

Operations on colors.

type t = {
  1. r : float;
  2. g : float;
  3. b : float;
  4. a : float;
}
val premultiply : t -> t

Multiple all colors by alpha:

r = r*a

g = g*a

b = b*a

a = a

val rgbaf : r:float -> g:float -> b:float -> a:float -> t

Assumes all values are in the 0-1 range

val rgbf : r:float -> g:float -> b:float -> t

Assumes all values are in the 0-1 range

val rgba : r:int -> g:int -> b:int -> a:int -> t

Assumes all values are in the 0-255 range

val rgb : r:int -> g:int -> b:int -> t

Assumes all values are in the 0-255 range

val white : t

r=255 g=255 b=255 a=255

val black : t

r=0 g=0 b=0 a=255

val transparent : t

r=0 g=0 b=0 a=0

val lerp : t -> t -> a:float -> t

Linearly interpolates between two colors.

0 <= a <= 1

val clamp : float -> float -> float -> float

Clamp value min max

val transf : t -> float -> t

Set the alpha value, assumes 0-1 range

val trans : t -> int -> t

Set the alpha value, assumes 0-255 range

val hsl : h:float -> s:float -> l:float -> t

Create a color from HSL, alpha = 255

0 <= h <= 1

0 <= s <= 1

0 <= l <= 1

val hsla : h:float -> s:float -> l:float -> a:int -> t

Create a color from HSL with alpha

0 <= h <= 1

0 <= s <= 1

0 <= l <= 1

0 <= a <= 255

OCaml

Innovation. Community. Security.