# `Issho.Color`
[🔗](https://github.com/hattoriai/issho/blob/v0.1.0/lib/issho/color.ex#L1)

The colours of the people of a room.

An actor's own colour goes to other people's browsers, so only a plain
CSS colour passes (`sanitize/1`). An actor with no colour gets an index
into the theme's palette (`index/1`, 1 to 8, the same for a key in every
browser and node): the theme decides the colours, so Sumi and a dark mode
can choose their own (`--issho-person-1` … `--issho-person-8`).

# `index`

```elixir
@spec index(String.t()) :: pos_integer()
```

The palette index of a key, from 1 to 8.

    iex> Issho.Color.index("user:4") in 1..8
    true

# `palette_size`

```elixir
@spec palette_size() :: pos_integer()
```

The number of colours in a theme's palette.

# `sanitize`

```elixir
@spec sanitize(term()) :: String.t() | nil
```

The colour if it is a plain CSS colour, else `nil`.

    iex> Issho.Color.sanitize("#2563eb")
    "#2563eb"
    iex> Issho.Color.sanitize("red; background: url(x)")
    nil

---

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