Skip to content

Fix initial color flash on map load#183

Open
pierres wants to merge 1 commit intostephanwagner:masterfrom
pierres:fix/initial-color-flash
Open

Fix initial color flash on map load#183
pierres wants to merge 1 commit intostephanwagner:masterfrom
pierres:fix/initial-color-flash

Conversation

@pierres
Copy link
Copy Markdown
Contributor

@pierres pierres commented Mar 8, 2026

Summary

On load, country paths briefly render with the hardcoded CSS fallback color (#E2E2E2) before applyData() sets the final colors. Combined with the fill 250ms CSS transition, this causes a noticeable flash — especially when colorNoData differs significantly from the default (e.g. dark themes).

Solution

Set --svg-map-country-fill CSS variable on the map wrapper to colorNoData before SVG paths render. Since the variable cascades to all .svgMap-country elements, they start with the correct color. Only countries with data smoothly transition to their data color.

Set --svg-map-country-fill CSS variable on the map wrapper to colorNoData
before SVG paths render, so countries start with the correct no-data color
instead of the hardcoded CSS fallback. This prevents a visible flash
when using custom colorNoData values (e.g. dark themes).
@pierres pierres force-pushed the fix/initial-color-flash branch from 1a8ad8c to c312557 Compare March 8, 2026 15:44
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