From 5e00bf86a81f13e45a8de182f21c89249a6fcb9c Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Fri, 25 Sep 2026 03:09:24 +0000 Subject: [PATCH] lift warm tonal surfaces to the bright gradient tone --- .../main/kotlin/com/subtracks/ui/theme/ArtworkTheme.kt | 9 ++++----- .../kotlin/com/subtracks/ui/theme/ArtworkColorsTest.kt | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/subtracks/ui/theme/ArtworkTheme.kt b/app/src/main/kotlin/com/subtracks/ui/theme/ArtworkTheme.kt index e4cb8b10..c724f87c 100644 --- a/app/src/main/kotlin/com/subtracks/ui/theme/ArtworkTheme.kt +++ b/app/src/main/kotlin/com/subtracks/ui/theme/ArtworkTheme.kt @@ -34,7 +34,6 @@ private const val DARKEN_END_SCREENS = 1.5f private const val DARKEN_KNEE = 0.2f private const val PLAYER_SURFACE_SATURATION_FACTOR = 1.6f private const val LIBRARY_SURFACE_LIGHTNESS = 0.10f -private const val WARM_SURFACE_SATURATION_DAMPING = 0.2f @Immutable data class ArtworkColors( @@ -210,14 +209,14 @@ fun ArtworkTheme( fun playerSurfaceColor(artwork: ArtworkColors): Color { val (hue, saturation, lightness) = artwork.scheme.surfaceContainerHigh.toHsl() - val damping = if (isWarmHue(hue)) WARM_SURFACE_SATURATION_DAMPING else 1f - return Color.hsl(hue, (saturation * PLAYER_SURFACE_SATURATION_FACTOR * damping).coerceIn(0f, 1f), lightness) + if (isWarmHue(hue)) return artwork.gradientHigh + return Color.hsl(hue, (saturation * PLAYER_SURFACE_SATURATION_FACTOR).coerceIn(0f, 1f), lightness) } fun librarySurfaceColor(artwork: ArtworkColors): Color { val (hue, saturation, _) = artwork.scheme.surfaceContainerHigh.toHsl() - val damping = if (isWarmHue(hue)) WARM_SURFACE_SATURATION_DAMPING else 1f - return Color.hsl(hue, (saturation * damping).coerceIn(0f, 1f), LIBRARY_SURFACE_LIGHTNESS) + if (isWarmHue(hue)) return lerp(artwork.gradientHigh, artwork.scheme.surfaceContainerHigh, 0.5f) + return Color.hsl(hue, saturation, LIBRARY_SURFACE_LIGHTNESS) } private fun isWarmHue(hue: Float): Boolean = hue in 0f..120f diff --git a/app/src/test/kotlin/com/subtracks/ui/theme/ArtworkColorsTest.kt b/app/src/test/kotlin/com/subtracks/ui/theme/ArtworkColorsTest.kt index 1ebb1d18..9305b4a6 100644 --- a/app/src/test/kotlin/com/subtracks/ui/theme/ArtworkColorsTest.kt +++ b/app/src/test/kotlin/com/subtracks/ui/theme/ArtworkColorsTest.kt @@ -59,6 +59,14 @@ class ArtworkColorsTest { } } + @Test + fun warmArtworkLiftsPlayerSurfaceToTheBrightGradientTone() { + val warm = artworkColorsFromSeed(0xFFE6C822.toInt()) + val cool = artworkColorsFromSeed(0xFF3A7BD5.toInt()) + assertEquals(warm.gradientHigh, playerSurfaceColor(warm)) + assertTrue(playerSurfaceColor(cool) != cool.gradientHigh) + } + private fun contrast( a: Color, b: Color,