#114

Background color used for text

Openrothsandroopened 1mo ago

The --pele-bg variable is not just used for backgrounds, as described in the documentation, but also as text color on .pebe-label elements in a few diagrams: Gantt, Git graph, Sequence, Timeline. Is this expected?

<text class="pele-label" fill="var(--_bg)" ...>71</text>

The examples on the website already don't have very good contrast:

But it gets worse with a light accent color (which fills the bar):

Activity

1
dhruv12201mo ago

Short answer: the pattern is deliberate, but the assumption behind it is fragile.

I checked the four spots. In each one --_bg (the page background, --pele-bg, default white) is the fill of text drawn on top of a colored shape, so it reads as "light text on a dark chip":

  • Git graph (src/diagrams/git/render.ts): branch name on a fill="<series color>" rect.
  • Timeline (src/diagrams/timeline/render.ts, ON_COLOR): section header and period labels on fill="<series color>" boxes.
  • Gantt (src/diagrams/gantt/render.ts): inside-bar label on the accent/critical bar, only when the task is neither done nor active.
  • Sequence (src/diagrams/sequence/render.ts, autonumber badge): number on a fill="var(--_l)" chip, which defaults to the dark line color, so it holds up by default.

The failure mode is exactly your second screenshot: the code assumes the chip is dark. With a light accent filling the bar, background-colored text on a light chip is unreadable. The website examples are the same pattern with middling contrast rather than a separate bug.

A fix in the direction of the existing code would be to pick the ink from the chip color instead of hardcoding --_bg: sequence already does this elsewhere with its local inkOn helper (luminance-aware ink for a given fill, used for actor labels and run titles). Extending that idea to these four spots would keep the dark-chip look and fix the light-accent case. Happy to turn this into a PR if the maintainers agree that is the right shape for the fix.