Skip to content

Fix legend colour overflow with palette-matched fallback colours#12

Merged
masonlet merged 4 commits into
mainfrom
fix/legend-colour-overflow
Jul 9, 2026
Merged

Fix legend colour overflow with palette-matched fallback colours#12
masonlet merged 4 commits into
mainfrom
fix/legend-colour-overflow

Conversation

@masonlet

@masonlet masonlet commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Segments cycled colours with colours[i % colours.length] but the legend
indexed raw (colours[i]), so any theme with fewer colours than the
requested language count rendered fill="undefined" while
segments silently repeated colours.

Changes

  • Extracted resolveColour (in the renamed charts/helpers.ts) as the
    single place both segments and legend resolve a colour for a given index.
  • Once index exceeds the palette length, resolveColour now generates a
    new colour instead of repeating: hue is spaced by the golden angle
    (137.508°) for even visual separation, and saturation/lightness are
    averaged from the active theme's own palette so generated colours match
    its look rather than using a fixed guess.
  • Renamed stale github-top-languages reference in package.json.
  • Bumped to 1.2.0

@masonlet
masonlet merged commit 267f25a into main Jul 9, 2026
2 checks passed
@masonlet
masonlet deleted the fix/legend-colour-overflow branch July 9, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant