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

Open
#417 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript

Research direction

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.

Written by the indexing model from the issue text.

Description

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.
Dominant language
JavaScript
Stars
3
Forks
18
Avg merge
1d 15h
Merged PRs (30d)
27

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ReduxISU/Redux_GUI

All issues in ReduxISU/Redux_GUI

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.