fix: night map preserves hue instead of crushing to black

The previous night filter used a desaturating invert whose coefficients
summed to ~1.4 per channel, which pushed every (light) OSM tone to
near-black and erased forest/water/land differentiation. Replace it with
a lightness invert composed with a 180° hue rotation: the map darkens but
hue is preserved, so forests stay dark green, water dark blue, and labels
invert to readable white.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tYbcy4UGWxqQbcycyL7Yd
This commit is contained in:
Claude
2026-06-18 23:24:30 +00:00
parent 2d563aba07
commit f0ea68f440
@@ -51,26 +51,28 @@ private const val DEFAULT_ZOOM = 16.0
/**
* Night-mode filter for the (always-light) MAPNIK tiles so the map follows the
* app theme. Inverts lightness while desaturating, which reads as a clean dark
* grey map — unlike a plain colour invert, which turns forests magenta and
* water orange.
* app theme. This is a lightness invert composed with a 180° hue rotation: it
* darkens the map (light land → near-black) while *preserving* hue, so forests
* stay green and water stays blue and the surfaces remain distinguishable —
* unlike a plain colour invert (forests → magenta) or a desaturating invert
* (everything → black).
*/
private val NIGHT_TILE_FILTER: ColorFilter =
ColorMatrixColorFilter(
floatArrayOf(
-0.6f,
-0.4f,
-0.4f,
0.574f,
-1.430f,
-0.144f,
0f,
255f,
-0.4f,
-0.6f,
-0.4f,
-0.426f,
-0.430f,
-0.144f,
0f,
255f,
-0.4f,
-0.4f,
-0.6f,
-0.426f,
-1.430f,
0.856f,
0f,
255f,
0f,