# `MishkaDocument.WorkspaceAccent`
[🔗](https://github.com/mishka-group/mishka_document/blob/v0.0.1/lib/mishka_document/workspace_accent.ex#L5)

The two colours a workspace card wears: one for how far along it is, one for what language it is in.

## The card's chrome says how done it is — `for_progress/1`

Its bar, tile, completion track, stat icons and ring are banded by completion:

| Completion | Reads as    | Colour           |
| ---------- | ----------- | ---------------- |
| `0–29`     | behind      | red `#d5544b`    |
| `30–49`    | started     | amber `#cf8a24`  |
| `50–79`    | in progress | indigo `#5b57d6` |
| `80–99`    | success     | green `#1f9d6b`  |
| `100`      | complete    | blue `#2f86c4`   |

Blue is exactly 100 and nothing else — its whole job is to mean *finished*, and 99% is not finished,
so the last stretch stays green. Every tone is one the design already uses: the three its Logs and
Issues panels wear, plus two from its language palette.

Colouring the chrome by *language* is what the design does, but it does not survive this list. The
list shows one row per document (`MishkaDocument.WorkspaceScope`), so every row is a master, and in
practice masters are nearly all one language — every card came out the same colour, and the colour
said nothing. Completion varies per card and is the thing worth reading across a grid.

## The badges still say which language — `of/1`

The language badge and the edition chips keep their language colour, because that is the one place
the colour still carries information: `EN · Primary` beside `FA · 100%` is only legible if the two
differ. The design names five — EN indigo, FA green, RU amber, FR pink, DE blue — but `language` is
a free ISO-639-1 string, so an unnamed one (`ar`, `zh`, `pt`) is *hashed* into the same five rather
than all falling back to one. `:erlang.phash2/2` is stable, so a language keeps its colour for good
(the same trick `MishkaCmsCore.Activity.Helpers.avatar_tone/1` uses for actor avatars).

An archived workspace ignores both and goes grey — archived reads as inactive before it reads as
Farsi or as 80% done.

Every value is a Tailwind class, not a hex string: the runtime CSS compiler only emits a class it
can see written out, so the palette has to be literal (see `MishkaCmsCoreWeb.Templates.…` ports).

    iex> MishkaDocument.WorkspaceAccent.of(%{language: "en", status: :active}).bar
    "bg-[#5b57d6]"

    iex> MishkaDocument.WorkspaceAccent.for_progress(%{health_metrics: %{completion: 92}}).bar
    "bg-[#1f9d6b]"

# `for_progress`

```elixir
@spec for_progress(map()) :: map()
```

The accent a workspace's *chrome* wears — how far along it is, or grey once archived.

`health_metrics` is field-policy gated, so it can arrive unloaded; a workspace nobody can measure
reads as 0% and shows as behind rather than crashing the card.

# `of`

```elixir
@spec of(map()) :: map()
```

The accent a workspace's language badge wears — its language's colour, or grey once archived.

---

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