Visualization labels: unreadable colors on node and clause fills, and labels that don't fit

Aperta
#417 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript

Direzione di ricerca

Start by reading StandardGraphSvgReact.js and VisColorsArray.js, then inspect StandardSATSvgReact.js, the SAT and Set renderers, and StandardCircuitSvgReact.js for the listed label cases. Reproduce the contrast and fit problems in both themes, including short clauses with large weights and long names. Done means the shared color helper is used, the stated readability and overlap criteria are met, and e2e coverage exercises both themes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Some text inside visualizations is hard to read, or doesn't fit, because the renderers color and place labels without looking at what's behind them. This came up in review of #416, but it affects several problems, so it should be fixed once, in one PR.

1. Label color ignores the color behind it

Labels drawn on a fixed color take the page theme's text color. The fill stays the same in both themes, so the label's contrast depends on the theme.

Where Label Behind it Who it affects
StandardGraphSvgReact.js node name node fill, #abc by default, or a color from the backend every problem drawn with the Graph renderer
StandardSATSvgReact.js (added by #416, not merged yet) clause weight w=… clause box, always #abc Weighted Max-SAT

Contrast of the theme's heading color on the palette (VisColorsArray.js). Below 4.5:1 fails WCAG AA for normal text:

Fill Dark mode (#F9FAFB) Light mode (#111827)
Background #abc 1.88 9.03
Solution #00e676 1.60 10.63
ElementHighlight #f69240 2.21 7.69
Sand #DDCC77 1.55 10.96
Cyan #88CCEE 1.69 10.07
Teal #44AA99 2.70 6.30
Olive #999933 2.89 5.88
ClauseHighlight #989898 2.76 6.15
SolutionAlt #E600E3 3.67 4.62
Rose #CC6677 3.50 4.84
Red #FF0000 3.83 4.44
Green #117733 5.42 3.13
Purple #AA4499 5.03 3.38
Wine #882255 8.35 2.03
Indigo #332288 11.65 1.46

So a default graph node is nearly unreadable in dark mode, and the darker palette colors have the same problem in light mode. No single text color works: the label color has to be chosen from the fill.

The SAT and Set renderers' literal and element text sets no fill, so it is always black. That is fine on #abc, but check it on the dark palette colors, since the fill can come from the backend.

2. Labels don't always fit their space

  • Clause weights: the w=… label is centered over its clause, but only the right edge gets extra room. A label wider than its clause (a short clause with a large weight) runs left into the previous clause. (#416)
  • Graph nodes: circles have a fixed radius of 20 and names are drawn at 12px, so a long name runs out of its circle. Part of the label then sits on the page background and part on the node, so it needs to read on both.
  • SAT and Set boxes: box widths are estimated with size * name.length - 7, not measured, so check them with long names.

These come from reading the code. Reproduce each one when fixing it.

What done looks like

  • One shared helper picks a readable label color for a given fill, and the renderers above use it
  • Every label drawn on a fill reaches at least 4.5:1 in both themes, for every palette color
  • A label that spills past its fill is still readable on the page background (shortened, moved, or given a backing)
  • Clause weights never overlap the neighboring clause, including very short clauses with very large weights
  • Also check the gate and overlay labels in StandardCircuitSvgReact.js, which weren't fully reviewed here
  • e2e coverage for both themes

Related

  • #416 adds the clause weight label. It was approved with this follow-up, so this work should start after it merges, or handle the label once it does.
  • ReduxISU/Redux#850 is the same kind of dark-mode color problem in a different picture.
Lingua principale
JavaScript
Stelle
3
Fork
18
Merge medio
1g 15h
PR unite (30g)
27

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ReduxISU/Redux_GUI

Tutte le issue di ReduxISU/Redux_GUI

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.