Skip to content

Update themes - #1673

Merged
devemux86 merged 1 commit into
masterfrom
themes
Mar 10, 2025
Merged

devemux86 merged 1 commit into
masterfrom
themes

Conversation

@devemux86

Copy link
Copy Markdown
Collaborator

No description provided.

@devemux86 devemux86 added this to the 0.25.0 milestone Mar 10, 2025
@devemux86
devemux86 merged commit ff177e7 into master Mar 10, 2025
@devemux86
devemux86 deleted the themes branch March 10, 2025 12:04
@Sublimis

Copy link
Copy Markdown
Contributor

Why did you remove the motorider-dark theme when there is no alternative??

@devemux86

Copy link
Copy Markdown
Collaborator Author

@Sublimis Because we would need to maintain it upstream.
And it only contains the dark variant of 1 specific theme.

If you need it, I think @MotoUKRider still updates it here:


Anyway there is a better and global alternative that works on all themes:
Use the ThemeCallback to customize the colors of map elements and resources.

See an example for grayscale in ColorFilterMapViewer sample.

@Sublimis

Copy link
Copy Markdown
Contributor

Anyway there is a better and global alternative that works on all themes: Use the ThemeCallback to customize the colors of map elements and resources.

Tried that again now, unfortunately it's still not useful, just like in the past.
Even if we accept that color inversion could be a viable alternative to a true dark theme (debatable!), just look at the color inversion done through the ThemeCallback vs. proper color inversion done in paint software vs. the original:

image image image

As you can see, the hill shading and text are not getting any callbacks, and who knows what else.

@devemux86

Copy link
Copy Markdown
Collaborator Author

@Sublimis No one said anything about using color inversion for dark colors.

Can check the RenderInstruction in getColor to change only the required elements.

And darken the original color e.g. using its HSL / HSV attributes.
There is some code in VTM ColorUtil.

@Sublimis

Copy link
Copy Markdown
Contributor

Not sure I get the point.
We already implemented linear dimming in a much simpler way, without the complications of ThemeCallback.
This is not the same as having a dedicated dark theme.

The simplest way to simulate a "dark theme" is to do the color inversion... But the exact algorithm is not the point. The point is that there is no real alternative to a dedicated dark theme, and that the ThemeCallback doesn't work properly, at least not for DirectRenderer... (not motivated to deal with this) 😜

@Sublimis

Copy link
Copy Markdown
Contributor

This was the code to invert colors, for completeness:

displayModel.setThemeCallback(new ThemeCallback()
{
	final Paint mPaint = new Paint();
	final ColorFilter mColorFilter = new ColorMatrixColorFilter(new float[]{
			-1, 0, 0, 0, 255, 0, -1, 0, 0, 255, 0, 0, -1, 0, 255, 0, 0,
			0, 1, 0});

	@Override
	public Bitmap getBitmap(final Bitmap bitmap)
	{
		mPaint.setColorFilter(mColorFilter);
		android.graphics.Bitmap immutable = AndroidGraphicFactory.getBitmap(bitmap);
		android.graphics.Bitmap mutable = immutable.copy(android.graphics.Bitmap.Config.ARGB_8888, true);
		Canvas androidCanvas = new Canvas(mutable);
		androidCanvas.drawBitmap(mutable, 0, 0, mPaint);
		return new AndroidBitmap(mutable);
	}

	@Override
	public int getColor(final RenderInstruction origin, final int color)
	{
		return Color.argb(Color.alpha(color), -Color.red(color) + 255, -Color.green(color) + 255, -Color.blue(color) + 255);
	}

	@Override
	public String getText(PointOfInterest poi, String text)
	{
		return text;
	}

	@Override
	public String getText(PolylineContainer way, String text)
	{
		return text;
	}
});

@Sublimis

Copy link
Copy Markdown
Contributor

Here's an idea: Maybe a script could be made that will generate motorider-dark.xml by inverting/altering colors of the motorider.xml (or any other theme file) 😁

@devemux86

devemux86 commented Jun 19, 2025 •

Copy link
Copy Markdown
Collaborator Author

@Sublimis Motorider + Biker themes are maintained in both VTM + Mapsforge
and all 4 themes are progressing at the same time and with the same changes.

Now only the 2 Motorider themes have a dark version:

We can ask @MotoUKRider if he can create dark versions, but for all 4 themes.

Then if all 4 themes have a dark version, we could include them in repositories.

@devemux86

Copy link
Copy Markdown
Collaborator Author

@Sublimis Also the dark theme zip now contains 2 dark themes: dark and indigo.

So all dark versions are x2 and so it's their maintenance by @MotoUKRider.

@MotoUKRider

Copy link
Copy Markdown

@Sublimis As I understand, Cruiser never had a "Dark" theme until I wrote one for @devemux86 which was included in previous App builds, but has since been removed. The idea was to take the default/normal "Light" theme and simply tame the colours for night-time use. I also included an "Indigo" version as several other Apps have that style, and I personally prefer it.

The above themes are all based on the "Biker" theme that Cruiser used which, according to my older files, contained around 1200 lines. We're now at 2200 so there's a considerable difference to what we had a year ago. New rules, improved sequential rendering (ie: thin hair-lines at zoom-n, then a normal road at zoom-n+1) and the "Layers" menu for the POIs/features.

There's been many (on+off-list) discussions about theme XMLs, versions, and keeping them "in sync" with each other. The idea is to offer a couple of general use map styles and the really keen user has the ability to load their own. The "Biker" theme has been tweaked slightly to resemble OpenStreetMap and the "Motorider" Default/Light theme I styled for UK roads.

I'm not an App-coder (or a historian, so forgive any errors), and can't comment or help with the API calls, but the theme XMLs are all in-sync so can be re-added. I think I left out a dedicated "Biker at Night" theme because when it's dark, nobody would notice 🤡

@devemux86

Copy link
Copy Markdown
Collaborator Author

I will add the Dark and Indigo map themes in both repositories.

@Sublimis

Copy link
Copy Markdown
Contributor

Thanks @devemux86 @MotoUKRider, new dark themes work great.

However the latest update changed hill shading color from #FFEEEEEE to #FF444444, and now dark themes don't work well with contour lines + hill shading, i.e. hill shading is practically invisible behind contour lines. Please see below for comparison of Biker Indigo vs. light themes.

It would probably be best to darken the contour lines for dark themes, and lighten the hill shading a bit?

image image

@devemux86

Copy link
Copy Markdown
Collaborator Author

@Sublimis Old hillshading color was too light and in dark themes the rendering was not nice.

If current hillshading color is too dark,
@MotoUKRider we can set it a bit lighter like #FF888888 in dark themes.

@Sublimis

Copy link
Copy Markdown
Contributor

@Sublimis Old hillshading color was too light and in dark themes the rendering was not nice.

If current hillshading color is too dark, @MotoUKRider we can set it a bit lighter like #FF888888 in dark themes.

Why not also darken the contour lines a bit? In Biker light theme the contour lines are all like #8E8072, which is a nice middle shade that should work nicely in both light and dark themes. Thus it appears there should be no need to lighten the contour lines to #a4998e like they are now in Indigo theme. But the exact shade for contours is a minor issue really, as long as they are not too prominent.

@devemux86

Copy link
Copy Markdown
Collaborator Author

@Sublimis About the contour line color in dark themes, @MotoUKRider can also see it.

@MotoUKRider

MotoUKRider commented Jun 25, 2025 •

Copy link
Copy Markdown

There is a marked difference between the contour lines' visibility depending upon whether hillshading is enabled. Simply by turning it on/off as well as varying the intensity alters how clear they are. It's going to be tricky finding a happy medium but I can certainly make them consistent across the map "engine" types (they may need to vary between light/dark).

So, in short, from tests - it's very easy to make a "Dark" map with full-intensity hillshading have nice contour-lines, but if you then turn off the shading, the lines are very "visible".

It's a lot of detail to worry about in what is, essentially, a night-time navigation theme 🌃 🌙

@devemux86

Copy link
Copy Markdown
Collaborator Author

Also, hillshading is mainly intended for light themes.

Dark themes are most useful in navigation, where hillshading has little use.

@Sublimis

Copy link
Copy Markdown
Contributor

@devemux86
Hill shading may look nicer on light themes, yes, but dark themes are not useful only for navigation, but for every low-light situation where one doesn't want to strain their eyes or be distracted. And still be able to see hill shading while exploring the map.

@MotoUKRider
Disagree. To be visible on dark map, hill shading is made lighter. To be visible on lighter hill shading, contour lines are made darker. When light hill shading is then turned off, darker contour lines are not too prominent over the dark map (w/o hill shading).

Thus it would be enough to simplify things and just leave the contour lines color as is in the light theme (#8E8072). Nice mid-shade that works for both light and dark maps. Or make them a bit darker (not lighter!).

This is what was already said earlier. To illustrate, here is the Indigo theme with contour lines made #8E8072:

image image

On the first image the hill shading is #444444, on the second image it is #808080 (@devemux86 note that this is the middle shade of gray, while also being less prone to mistakes in digits count).

Maybe the hill shading could be made something like #606060? (the other image is the same as above):

image image

@devemux86

Copy link
Copy Markdown
Collaborator Author

@MotoUKRider @Sublimis

Agreed, let's use the same contour line color #8E8072 in all map themes (light + dark).
We already do this in all VTM map themes.

About the hillshading color in dark themes, I think the #606060 appears better.

@MotoUKRider

Copy link
Copy Markdown

Simple online edits, best made by someone who can see the changes within their development tools.

@devemux86

devemux86 commented Jun 26, 2025 •

Copy link
Copy Markdown
Collaborator Author

@MotoUKRider @Sublimis

I pushed the changes in the 2 dark themes.
Now they use the same colors with VTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants