# `Delux.RGB`
[🔗](https://github.com/elixir-circuits/delux/blob/v0.4.2/lib/delux/rgb.ex#L5)

Utilities for RGB tuples

# `color`

```elixir
@type color() ::
  :black
  | :red
  | :yellow
  | :green
  | :cyan
  | :blue
  | :magenta
  | :white
  | :on
  | :off
  | t()
```

# `component`

```elixir
@type component() :: 0 | 1 | float()
```

Colors components go from 0 (off) to 1 (brightest)

# `t`

```elixir
@type t() :: {component(), component(), component()}
```

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.

# `new`

```elixir
@spec new(color()) :: t()
```

Create a new RGB tuple

You can pass in a tuple or a color name.

# `to_ansidata`

```elixir
@spec to_ansidata(color(), String.t()) :: IO.ANSI.ansidata()
```

Convert a color to a human-readable ansidata

```elixir
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}"]
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
