Skip to content

feat(layers): honor normalizedColors for GeoJSON color accessors - #11157

Merged
ibgreen merged 5 commits into
masterfrom
codex/normalized-geojson-colors
Nov 17, 2026
Merged

ibgreen merged 5 commits into
masterfrom
codex/normalized-geojson-colors

Conversation

@ibgreen

@ibgreen ibgreen commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

For #11146

Background

GeoJsonLayer passes colors to child layers that use byte channels. Decode normalized plain-array inputs once at the GeoJSON boundary and preserve generated defaults, typed arrays, and binary inputs.

Change List

  • Convert user color accessors before forwarding to sublayers
  • Invalidate mapped color callbacks when the Deck convention changes
  • Document normalized GeoJSON input and byte storage
  • Unit tests cover point, line, and polygon forwarding

Verified with yarn lint and eight focused Chromium tests.


Note

Low Risk
Opt-in behavior gated behind the normalizedColors flag with fallback to existing byte encoding, covered by unit tests.

Overview
Extends the normalizedColors Deck setting to top-level GeoJsonLayer instances. Plain JavaScript array color accessors and constants (including fill, stroke, icon, and text colors) can now be supplied in 0–1 channels.

In forwardProps, color accessors are wrapped or converted to standard 0–255 byte arrays before forwarding to child sublayers, while preserving defaults, typed arrays, and binary inputs. Update triggers are also updated to invalidate child color attributes when normalization changes.

Reviewed by Cursor Bugbot for commit 0c1b2ff. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

Adds support for normalized plain-array colors in top-level GeoJsonLayer.

  • GeoJSON color accessors follow Deck's normalized color setting.

Reviews (5) · Last reviewed commit: "Normalize GeoJSON text outlines before f..." · Reviewed by Greptile

@ibgreen ibgreen mentioned this pull request Nov 17, 2026
22 of 52 tasks
@coveralls

coveralls commented Nov 17, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 83.619% (+0.008%) from 83.611% — codex/normalized-geojson-colors into master

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4b9c3ac. Configure here.

@ibgreen
ibgreen merged commit 91bf22c into master Nov 17, 2026
9 checks passed
@ibgreen
ibgreen deleted the codex/normalized-geojson-colors branch November 17, 2026 18:50

@chrisgervang chrisgervang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 0c1b2ff after merge; follow-ups below. One P1: the GeoJsonLayer paragraph renders under filled, and the color entries still say 0–255. Both are still on master. Defaults, typed arrays and the byte boundary at the sublayers are sound.

Labels: P1 settle before this is merged, P2 can follow, Non-blocking optional.


Generated by Claude Code

Comment on lines +225 to +229
With Deck's [`normalizedColors`](../core/deck.md#normalizedcolors), plain-array color
accessors on a top-level GeoJsonLayer use 0–1 channels. This includes constants and
callback results for fills, strokes, icons, and text colors. Omitted alpha is opaque.
The layer converts these colors to bytes before forwarding them to its sublayers.
Built-in defaults, typed arrays, and binary attributes keep their existing encoding.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This paragraph sits above #### getFillColor, so it renders as the end of filled. getFillColor and getLineColor still say "Each channel is a number between 0-255". The sentence about converting to bytes before forwarding gives the reader nothing to act on.

Could we drop the paragraph and give each color entry the ScatterplotLayer sentence? The guide already lists the kept encodings.

Details
  • ScatterplotLayer sentence: "Channels use the 0–255 range by default. See Deck’s normalizedColors to use 0–1 plain arrays."
  • On master the entries are at geojson-layer.md:236 and :261.

Generated by Claude Code

Comment on lines +182 to +185
result.updateTriggers[targetKey] =
normalize && typeof value === 'function'
? [normalize, ...(Array.isArray(trigger) ? trigger : [trigger])]
: trigger;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: With normalizedColors on, an object updateTriggers entry now recomputes the child color attribute on every update. [true, trigger] makes the compare check the object by identity, so an inline {getFillColor: {scheme}} changes each render. Before, its keys were compared.

Could this use the object-preserving helper that TextLayer and PolygonLayer use?

Details
  • compareProps compares one level, so array element 1 is compared with ===.
  • Same helper: text-layer.ts:49, polygon-layer.ts:30, fill-style-extension.ts:340 on master.

Generated by Claude Code

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.

3 participants