Skip to content

feat: high-contrast cluster markers over choropleths - #509

Merged
joaquimds merged 1 commit into
mainfrom
feature/coop-3729-white-markers-when-data-viz-is-active-for-better-visibility
Sep 23, 2026
Merged

joaquimds merged 1 commit into
mainfrom
feature/coop-3729-white-markers-when-data-viz-is-active-for-better-visibility

Conversation

@joaquimds

Copy link
Copy Markdown
Member

Closes COOP-3729 — https://linear.app/commonknowledge/issue/COOP-3729/white-markers-when-data-viz-is-active-for-better-visibility

What

When a choropleth fill is painted, cluster markers switch to a high-contrast style: a white disc with a 1px edge in the marker colour, and the count drawn in the marker colour. Pin strokes and icon halos widen from 1px to 2px. When no choropleth is painted, markers are unchanged.

Pale marker colours are darkened (by luminance, preserving hue) for the edge and count so they still read against white.

Why not the per-scheme rules in the issue

  • The clash depends on both the choropleth colour and the marker colour, and marker colour is configurable per data source and view. A list keyed on scheme alone can't cover it (and misses Sequential blues vs the default blue member colour).
  • White-middle schemes fail white markers exactly where data is mid-range; blues fail them at the pale end. A data-density heuristic would flip styles as filters change and still only approximates what's on screen after opacity and basemap blending.
  • A white disc with a coloured edge is two-tone, so at least one tone contrasts with any background.

Changes

  • ClustersLayer.tsx, PinsLayer.tsx: new onChoropleth flag branches the paint properties.
  • Markers.tsx: derives the flag from the choropleth toggle, a selected boundary set and loaded area stats; passed through DataSourceMarkers. Applies to public maps too.
  • src/utils/colors.ts: getContrastingRingColor and a shared parseRgb; colorWithAlpha now uses it.
  • tests/unit/utils/colors.test.ts: covers the parser, alpha helper and darkening.

Testing

  • npm run lint clean; npm test -- run tests/unit/utils/colors.test.ts passes.
  • Manually check red-blue, blues and a categorical choropleth with the toggle on and off, zoomed past the cluster zoom, and a public map with clustering.

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Sep 23, 2026

Copy link
Copy Markdown

COOP-3729

When a choropleth fill is painted, cluster markers switch to a
high-contrast style: a white disc at 87.5% opacity with a 1px edge in the
marker colour, and the count drawn in the marker colour. Pin strokes and
icon halos widen from 1px to 2px. When no choropleth is painted, markers
are unchanged.

A white disc with a coloured edge is two-tone, so at least one tone
contrasts with any background: white stands out on saturated fills and
the edge on pale ones. This avoids per-scheme rules, which cannot account
for the user-configurable marker colour. Pale marker colours are darkened
by luminance for the edge and count so they still read against white.

COOP-3729

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@joaquimds
joaquimds force-pushed the feature/coop-3729-white-markers-when-data-viz-is-active-for-better-visibility branch from f5060ca to b917b21 Compare September 23, 2026 13:22
@joaquimds
joaquimds merged commit 4abcba5 into main Sep 23, 2026
1 check passed
@joaquimds
joaquimds deleted the feature/coop-3729-white-markers-when-data-viz-is-active-for-better-visibility branch September 23, 2026 13:24
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