package ansifmt

  1. Overview
  2. Docs
type t =
  1. | Red of int
  2. | Green of int
  3. | Blue of int

Represents an RGB channel - either red, green, or blue.

val name : t -> string

name channel returns the name of the channel.

val value : t -> int

value channel retreives the underlying value of the channel.

val to_int8 : t -> (int, t) Stdlib.result

to_int8 channel tries to convert the channel's value into a Int8 value.

If it fails, it returns the channel data wrapped in the Error variant. This is because this function is often applied in batch to every channel of an RGB component, so the user can trace which channel's value was invalid.

val red : int -> t

red value creates a Red channel.

val green : int -> t

green value creates a Green channel.

val blue : int -> t

blue value creates a Blue channel.

OCaml

Innovation. Community. Security.