Repository navigation
Map: colours follow the nearest StyleScope - #619
Merged
Merged
Conversation
tokenColor() read every token on the page root, so a Map inside a StyleScope painted routes, areas, circles, 3D buildings and the basemap tint in the page's colours. It now takes the element to read on, and every caller passes the map's container. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtzVFyZmmZBfzzYmfhr
Test doubles for the map (and any map-like object an app passes) have no getContainer, which made MapRoute throw. Fall back to the page root. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtzVFyZmmZBfzzYmfhr
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Lorant · project thread
I found this while building a film over the Studio MCP. In the film's map flyover,
<MapRoute tone="accent">drew its route orange, which is once-ui.com's page accent. It should have been the film's own accent, which comes from theStyleScopethe film plays in.Cause
MapLibre's paint properties need plain colours, so
tokenColor()resolves each token to anrgb()string. It always read the token fromdocument.documentElement. That means any map inside aStyleScope(another brand, accent or theme) painted in the page's colours.Fix
tokenColor(variable, fallback, from?)now reads the token from the element it's given.map.getContainer():MapRoute,MapArea,MapCircle, the dark basemap tint inMap.impland the 3D buildings inscene.tokenColoris internal to the map module and isn't exported, so nothing public changes.Checks
pnpm typecheckinpackages/coreis clean.src/modules/mapreports only the one warning that's already onpreview(an unusedReacttype import inMapCircle).This is a non-breaking patch fix, a candidate for the next 3.1.x.
Generated by Claude Code