Skip to content

fix: improved gtfs visualization map readability#103

Merged
Alessandro100 merged 5 commits intomainfrom
fix/65-map-colors
Apr 13, 2026
Merged

fix: improved gtfs visualization map readability#103
Alessandro100 merged 5 commits intomainfrom
fix/65-map-colors

Conversation

@Alessandro100
Copy link
Copy Markdown
Contributor

@Alessandro100 Alessandro100 commented Apr 10, 2026

Summary:

closes #65

The gtfs map visualization did not properly support color contrast on light / dark mode maps. This lead to white routes being unreadable on light map, and dark routes being unreadable on dark maps

This PR introduces a contrast check between the route color and the map background, which also applies to the stop elements

Also includes map enhancements

  • Stops now only appear at a closer zoom
  • Highlighting a route increases its visibility
  • Rounded edges for routes

Expected behavior:

When you go on a map that has route colors that have low contrast with the map background, there should be halo lines to help with the contrast. ex:
https://mobilitydatabase-web-git-fix-65-map-colors-mobility-data.vercel.app/feeds/gtfs/mdb-2126/map
https://mobilitydatabase-web-git-fix-65-map-colors-mobility-data.vercel.app/feeds/gtfs/mdb-437/map

these aren't the most clear cut examples as there are limited feeds with visualization in dev environment but you still see the contrast coming out: (STM: the yellow metro line)

Testing tips:

Go on feeds with gtfs visualization and assure that the map feels good and that the colors have proper contrast

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with yarn test to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

Before
image
After
image

Before
image
After
image

Before (rounding)
image
After
Screenshot 2026-04-10 at 10 53 14

Before (stop zoom)
image
After
Screenshot 2026-04-10 at 10 55 02

Stops Contrast Highlights
Screenshot 2026-04-10 at 10 57 04

Screenshot 2026-04-10 at 10 56 57

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mobilitydatabase-web Ready Ready Preview, Comment Apr 13, 2026 0:35am

Request Review

@Alessandro100 Alessandro100 changed the title fix: map colors fix: improved gtfs visualization map readability Apr 10, 2026
@Alessandro100 Alessandro100 requested a review from Copilot April 10, 2026 14:58
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

*Lighthouse ran on https://mobilitydatabase-jlo4jca0q-mobility-data.vercel.app/ * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 99 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-jlo4jca0q-mobility-data.vercel.app/feeds * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 85 🟠 87 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-jlo4jca0q-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 52 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-jlo4jca0q-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 98 🟠 84 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-jlo4jca0q-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 94 🟢 94 🟢 96 🟢 100

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Skill applied: vercel-react-best-practices.

Improves GTFS map visualization readability across light/dark basemaps by adding contrast-aware route/stop styling and enhancing route/stops rendering behavior.

Changes:

  • Add a theme-level basemapTileOverallColor and use it to drive contrast-aware outline/halo styling.
  • Introduce a MapLibre expression to choose route outline colors based on contrast vs background/alternate outline color.
  • Enhance map layers: rounded route caps/joins, stronger highlight visibility, and updated stop highlight behavior; add unit tests for the new expression generators.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/app/Theme.ts Adds basemapTileOverallColor to the theme for contrast computations.
src/app/screens/Feed/components/FullMapView.tsx Fixes route type chip labels to use the common translator.
src/app/components/GtfsVisualizationMap.tsx Inserts the new highlight outline layer and passes theme to updated layer helpers.
src/app/components/GtfsVisualizationMap.layers.tsx Updates route/stops layer styling (contrast-aware outlines, rounded joins/caps, highlight tweaks).
src/app/components/GtfsVisualizationMap.functions.tsx Adds contrast/luminance helpers and a route-outline MapLibre expression generator.
src/app/components/GtfsVisualizationMap.spec.tsx Adds test coverage for the new contrast/expression logic.

const LIGHT_ALT = '#444444';
const DARK_ALT = '#ffffff';

describe('generateStopColorExpression', () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

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

LGTM

@Alessandro100 Alessandro100 merged commit 00a930b into main Apr 13, 2026
4 checks passed
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.

Maps: Update route color defaults on light mode

3 participants