From f0ea68f44032dac9443338abe16cdd1937412cc1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 18 Jun 2026 23:24:30 +0000 Subject: [PATCH] fix: night map preserves hue instead of crushing to black MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Claude-Session: https://claude.ai/code/session_017tYbcy4UGWxqQbcycyL7Yd --- .../creators/location/LocationPreviewMap.kt | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt index 06c8000794..984c3fc985 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt @@ -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,