MishkaDocument.WorkspaceAccent (Mishka Document v0.0.1)

Copy Markdown View Source

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:

CompletionReads asColour
0–29behindred #d5544b
30–49startedamber #cf8a24
50–79in progressindigo #5b57d6
80–99successgreen #1f9d6b
100completeblue #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]"

Summary

Functions

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

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

Functions

for_progress(arg1)

@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(workspace)

@spec of(map()) :: map()

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