derive the secondary text colour from the gradient luminance

This commit is contained in:
austinried
2026-10-04 00:29:53 +00:00
parent 4c8f3e1740
commit f725b25004
4 changed files with 44 additions and 22 deletions
@@ -48,6 +48,17 @@ class ArtworkColorsTest {
}
}
@Test
fun secondaryTextReadsOnGradient() {
for (seed in seeds) {
val colors = artworkColorsFromSeed(seed)
val backdrop =
(listOf(colors.gradientHigh, colors.gradientLow) + colors.accents)
.maxBy { it.luminance() }
assertTrue("onSurfaceVariant for $seed", contrast(colors.scheme.onSurfaceVariant, backdrop) >= 3f)
}
}
private fun contrast(
a: Color,
b: Color,