Criterion colour and acronym on the suggestion cards and the on-page pins
## Description
#3585833 added an acronym and a badge colour to every review criterion. The triage tray
renders neither. Every card in the list is drawn the same, and every pin on the page is the
same accent colour, so on a page with nine criteria nothing tells the editor which finding
belongs to which criterion without reading the label on each one.
Two surfaces, both in the merged code today:
| Surface | Today | Wanted |
|---|---|---|
| Suggestion card | label text, no colour | criterion colour on the category line and the card's leading edge |
| On-page pin | `criterion.charAt(0)`, one accent colour for all | the criterion's acronym, filled with its colour |
| Highlight rule | one `--acr-mark-rule` for all | the criterion's colour |
The pin is the sharper problem. `render()` in `js/suggestion_marks.js` builds the pin label
with:
```js
marker.textContent = criterion.charAt(0).toUpperCase();
```
So two criteria whose labels start with the same letter draw identical pins, and the editor
cannot tell them apart on the page at all. "Readability" and "Reading level" both give `R`.
The acronym field exists precisely to fix this and is not being read.
## What the prototype does
`Plan Improvements v3 (standalone).html`, attached to #3585830:
{width=723 height=600}
* The card takes a 3px leading border in the criterion's colour, and its category line
(`Tone and voice (TV)`) is set in a darker readable-on-white variant of it.
* **A decision overrides the criterion colour on that border.** Once a card is accepted,
ignored or reported, the leading edge switches to a status colour. Criterion identity is
what you need while triaging; after a decision, the decision is the more useful signal.
* The pin carries the two-letter acronym, filled with the criterion's colour, and a pin on
a light fill flips to dark text rather than staying white.
That last point is the same contrast problem the chips have.
## The card's category line needs a second colour
The badge colour is chosen to read as a filled dot on the page. Set as text on white it is
often too light. The prototype carries a hardcoded `TEXT_COLORS` map for exactly this rather
than deriving one, after trying and having to hand-patch the light end of the palette.
#3585833 stores one `badge_color`, from a closed palette of eight in `ReviewRuleForm`. Three
ways to get the readable partner: store it beside `badge_color`, compute it with a contrast
check, or keep a fixed table of eight. The table is the cheapest and stops being viable the
moment that field takes free input.
The filter chips follow-up needs the same partner colour for its label. Neither issue blocks
the other: whichever lands first makes the call and the second follows it.
## Tasks
* [ ] Decide how the readable-on-white colour is obtained, unless the filter chips follow-up
has already decided it. Record the decision on #3585833.
* [ ] Carry the acronym and the colours from the rule's criterion config through
`RenderHelpers::suggestionCard()` onto the card.
* [ ] Apply them on the card: criterion colour on the category line and the leading edge,
with a decided card's leading edge switching to its status colour.
* [ ] Apply them on the pin: label from the acronym rather than `criterion.charAt(0)`, fill
from the criterion colour, and text that flips to dark on a light fill.
* [ ] Apply them on the highlight rule. `paint()` registers highlights by name, so
per-criterion colour means one registered highlight per criterion rather than one for
all; check that the priority argument still resolves overlaps the way it does today.
* [ ] Confirm the degradation path is unchanged: where the Custom Highlight API is absent,
`paint()` still returns early and the pins still carry their acronym and colour.
* [ ] Cover it: a kernel test that a card carries its criterion's acronym and colours, and a
FunctionalJavascript test that two criteria sharing a first letter draw two different
pins.
## Acceptance criteria
* A criterion's acronym appears on its on-page pins.
* Two criteria whose labels begin with the same letter are distinguishable on the page.
* A criterion's configured colour appears on its card and its pins and its highlight rule,
and the three agree.
* A decided card shows its decision on the leading edge rather than its criterion colour.
* Text on a coloured surface meets contrast for every colour in the configured palette,
including the light end.
* Changing a criterion's acronym or colour in the rule form is reflected in the tray without
a re-run, since these are siblings of the hashed configuration and do not retire existing
records.
* A criterion with no acronym or no colour configured still renders, falling back to what
the tray does today rather than rendering blank.
## Out of scope
* The filter chips and their styling. Its own follow-up. Independent of this one: neither
blocks the other, and they share only the readable-colour decision above.
* The marker's hovered / ignored state model. Its own follow-up. That issue covers *which*
states a mark has; this one covers what colour they are drawn in. They touch the same CSS
and should be sequenced, not merged.
## Testing instructions *(added by implementor before review)*
1.
## Related issues
```
/relate #3585830
/relate #3585833
/relate #3585829
```
task
GitLab AI Context
Project: project/ai_content_review
Instance: https://git.drupalcode.org
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://git.drupalcode.org/project/ai_content_review/-/raw/1.x/README.md — project overview and setup
- https://git.drupalcode.org/project/ai_content_review/-/raw/1.x/CLAUDE.md — Claude Code instructions
Repository: https://git.drupalcode.org/project/ai_content_review
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD