Page MenuHomePhabricator

[spike] Places: Investigate whether a pre-packaged Dark theme exists for OpenStreetMap
Closed, ResolvedPublicSpike

Assigned To
Authored By
Dbrant
Sep 25 2023, 6:55 PM
Referenced Files
F41566621: mapstyle-list-01-dark.json
Dec 6 2023, 7:33 PM
F41566620: mapstyle-list-01-light.json
Dec 6 2023, 7:33 PM
F41566319: mapstyle-list-03-dark-apple-maps.txt
Dec 6 2023, 2:50 PM
F41566318: mapstyle-list-03-light-apple-maps.txt
Dec 6 2023, 2:50 PM
F41566312: mapstyle-list-02-dark-google-maps.txt
Dec 6 2023, 2:50 PM
F41566307: mapstyle-list-02-light-google-maps.txt
Dec 6 2023, 2:50 PM
F41566306: mapstyle-list-01-dark.txt
Dec 6 2023, 2:50 PM
F41549997: 1701393365386.jpg
Dec 1 2023, 1:16 AM

Description

The current Places PR uses a single style file (GeoJSON) that specifies the colors and shapes of every element displayed in the MapView.

Since all the elements are vector shapes, they can all be styled with different colors. The style that's currently in the PR is basically a "light" theme for the map. Can we find a similar style somewhere on the web that is a "dark" theme? If so, we can adapt it for our Places feature. And if not, we will need to duplicate the current "light" style and tweak all the individual colors to look appropriate for a dark theme.

Some documentation to pre-packaged themes: https://docs.mapbox.com/android/maps/guides/styles/set-a-style/

Event Timeline

Frostly changed the subtype of this task from "Task" to "Spike".Oct 2 2023, 9:24 PM
Sharvaniharan renamed this task from [spike] Places: Investigate whether a pre-packaged Dark theme exists for OpenStreetMap to [spike] Nearby: Investigate whether a pre-packaged Dark theme exists for OpenStreetMap.Nov 20 2023, 7:04 PM

Hi @scblr

I cannot find the predefined Dark theme from the library and cannot find the Wikimedia dark style for the map either.

Here's the current json file we are using for the map, it is a static file that will be included in the app.
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Kartographer/+/663867/9/mvt-style.json

If you check on the file above, you can notice some styling patterns by checking the id and its paint.

My question is:
Would that be helpful to provide you a list of id and its paint hex color for you to tune for the Dark theme? or maybe from the design team, you have a pre-defined color guideline for the map like what we did in the component work?

Hey @cooltey, thanks for the info. I have a clarifying question: isn’t Mapbox supposed to have a core dark theme, see this link or screenshot below:

CleanShot 2023-11-28 at 13.50.57@2x.png (2×3 px, 1 MB)

If we can’t use the core themes, it’d be good if you could provide the list you’ve mentioned. I think the most up-to-date resource to base this on is the Theme - Master file on Figma.

Hey @cooltey, thanks for the info. I have a clarifying question: isn’t Mapbox supposed to have a core dark theme, see this link or screenshot below:

It is from MapBox but we are using the open-source version called MapLibre, and it looks like the core styles are not included in the MapLibre library.

If we can’t use the core themes, it’d be good if you could provide the list you’ve mentioned. I think the most up-to-date resource to base this on is the Theme - Master file on Figma.

I cannot find the match colors for the dark theme from our theme guideline, maybe you have some ideas about it.

Here is the list of items with their colors:

@scblr
I tried to apply my own dark theme setting to the map and here is the demo:
https://www.youtube.com/shorts/Vwub0XfWEs4

And here is the config I used:

You can download the APK to see how it works:
https://github.com/wikimedia/apps-android-wikipedia/pull/4307

Please let me know if you need to tweak a bit, thanks!

Thanks @cooltey 👊

It is from MapBox but we are using the open-source version called MapLibre, and it looks like the core styles are not included in the MapLibre library.

I see; so MapBox and MapLibre are two completely different products?

And you are saying that is not possible to use MapBox’s style files from here? 👇

CleanShot 2023-11-30 at 13.38.59@2x.png (1×2 px, 579 KB)

I tried to apply my own dark theme setting to the map and here is the demo:

I will likely have to invest more time in this (and maybe play around directly in Android Studio), but could you try these styles for dark mode and maybe post some screenshots (or a video) ?

Hi @scblr

And you are saying that is not possible to use MapBox’s style files from here? 👇

Correct. The Mapbox styles are not included in the library so we cannot use them.

I will likely have to invest more time in this (and maybe play around directly in Android Studio), but could you try these styles for dark mode and maybe post some screenshots (or a video) ?

Done:
https://youtube.com/shorts/Uyl3AI3Hb1Q?feature=share

If you would like to update the configuration yourself, please edit the mapstyle-dark.json in the assets package.

1701393365386.jpg (338×571 px, 69 KB)

@cooltey

I will likely have to invest more time in this (and maybe play around directly in Android Studio), but could you try these styles for dark mode and maybe post some screenshots (or a video) ?

Done:
https://youtube.com/shorts/Uyl3AI3Hb1Q?feature=share

It's a bit better (the darker green), but it looks pretty similar to what you had previously! ;)

If you would like to update the configuration yourself, please edit the mapstyle-dark.json in the assets package.

1701393365386.jpg (338×571 px, 69 KB)

How about scheduling a session to try to tweak this together tonight? I added some time to our calendars!

I experimented with AI prompts @cooltey. I trained GPT-4 with best practices first. Then, I took several rounds of prompt writing and fine-tuning. Initial mistakes to not translate hslu, opacity, or shorthand hex code writing have been ironed out (in theory). I have high hopes. Can you try them out, please? Looking forward to our session later today! 👨‍🎨🎨

1) Dark theme based on the existing light theme (fine-tuned):

2) Uses a color scheme based on Google Maps for light and dark:


3) Uses a color scheme based on Apple Maps for light and dark:

Cooltey and I had a session today in which we tweaked the styles. These are the ones we are using now:

I consider this SPIKE as completed.

Sharvaniharan renamed this task from [spike] Nearby: Investigate whether a pre-packaged Dark theme exists for OpenStreetMap to [spike] Places: Investigate whether a pre-packaged Dark theme exists for OpenStreetMap.Dec 7 2023, 2:42 AM