package ansifmt

  1. Overview
  2. Docs

Module Color.ChannelSource

Sourcetype t =
  1. | Red of int
  2. | Green of int
  3. | Blue of int

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

Sourceval name : t -> string

name channel returns the name of the channel.

Sourceval value : t -> int

value channel retreives the underlying value of the channel.

Sourceval to_int8 : t -> (int, t) 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.

Sourceval red : int -> t

red value creates a Red channel.

Sourceval green : int -> t

green value creates a Green channel.

Sourceval blue : int -> t

blue value creates a Blue channel.