View Source Delux.RGB (delux v0.1.0)
Utilities for RGB tuples
Link to this section Summary
Link to this section Types
@type color() :: :black | :red | :yellow | :green | :cyan | :blue | :magenta | :white | :on | :off | t()
@type component() :: 0 | 1 | float()
Colors components go from 0 (off) to 1 (brightest)
An RGB triplet
Note that accuracy of the color depends on the LEDs in use. The color should be recognizable, but Delux doesn't support calibration.
Link to this section Functions
Create a new RGB tuple
You can pass in a tuple or a color name.
@spec to_ansidata(t(), String.t()) :: IO.ANSI.ansidata()
Convert a color to a human-readable ansidata
iex> RGB.to_ansidata(:red, "This is ")
[:red, "This is ", "red"]
iex> RGB.to_ansidata({0, 0.5, 1}, "This is ")
["This is ", "{0, 0.5, 1}"]