# `Cauldron2D.Client.Hud`
[🔗](https://github.com/jaman/cauldron/blob/v0.1.3/cauldron_2d/lib/cauldron_2d/client/hud.ex#L1)

The shapes a game's hud comes in, and one form every front end reads.

A hud is rows of runs — `[row]` drawn under the world — or `%{left: [row], width:
columns, bottom: [row]}`, a column of rows beside the world and rows under both. A
row is `[run]` or `{tag, [run]}`, the tag naming the row for a front end that styles
or hides rows by name. A run is text, `{text, colour}` or `{text, style}`, `colour`
an `{r, g, b}` or `nil` and `style` a map with `:fg` (an `{r, g, b}` or a colour
name `Linocut.Palette` knows) and `:bold`.

# `rgb`

```elixir
@type rgb() :: {byte(), byte(), byte()}
```

# `row`

```elixir
@type row() :: [run()] | {atom(), [run()]}
```

# `run`

```elixir
@type run() :: String.t() | {String.t(), rgb() | nil} | {String.t(), style()}
```

# `style`

```elixir
@type style() :: %{optional(:fg) =&gt; rgb() | atom(), optional(:bold) =&gt; boolean()}
```

# `t`

```elixir
@type t() ::
  [row()]
  | %{:left =&gt; [row()], :width =&gt; pos_integer(), optional(:bottom) =&gt; [row()]}
```

# `colour`

```elixir
@spec colour({String.t(), style()}) :: rgb() | nil
```

A run's foreground as `{r, g, b}`, or `nil`.

# `layout`

```elixir
@spec layout(t()) :: %{left: [row()], width: non_neg_integer(), bottom: [row()]}
```

The hud as a column of rows, its width in cells, and the rows under the world.

# `rows`

```elixir
@spec rows(t()) :: [row()]
```

Every row in reading order: the column, then the rows under.

# `runs`

```elixir
@spec runs(row()) :: [{String.t(), style()}]
```

The runs of a row as `{text, style}` pairs.

# `tag`

```elixir
@spec tag(row()) :: atom() | nil
```

A row's tag, or `nil`.

# `text`

```elixir
@spec text(row()) :: String.t()
```

A row's text with no styling.

---

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