v1.4.5: fix invisible text on tonal cards in dark mode

Insight cards (and the Goals/Update/Backfill tonal cards) have a fixed
light pastel background in both themes, but their content text used the
theme's onSurface — near-white in dark mode — so headlines vanished into
the light card. BentoCard already derived contrasting title/overline ink
via onTonal; the content lambdas now do the same for body, headline, and
actions.
This commit is contained in:
ngenohkevin
2026-06-08 09:17:25 +03:00
parent 20fe7ba5fd
commit 0a80be72a2
5 changed files with 22 additions and 11 deletions
+2 -2
View File
@@ -27,8 +27,8 @@ android {
applicationId = "com.ledga.app"
minSdk = 26
targetSdk = 34
versionCode = 14
versionName = "1.4.4"
versionCode = 15
versionName = "1.4.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -40,6 +40,7 @@ import com.ledga.app.ui.components.parseColor
import com.ledga.app.ui.components.v2.Avatar
import com.ledga.app.ui.components.v2.BackLeading
import com.ledga.app.ui.components.v2.BentoCard
import com.ledga.app.ui.components.v2.onTonal
import com.ledga.app.ui.components.v2.LedgaChip
import com.ledga.app.ui.components.v2.LedgaTopBar
import com.ledga.app.ui.theme.LedgaAccent
@@ -287,7 +288,7 @@ fun BackfillScreen(
"Account row at the bottom that lets you reassign one row " +
"at a time. Useful for stragglers.",
style = LedgaText.BodyM,
color = MaterialTheme.colorScheme.onSurface,
color = onTonal(LedgaAccentSoft),
)
}
@@ -35,6 +35,7 @@ import com.ledga.app.ui.components.parseColor
import com.ledga.app.ui.components.v2.BackLeading
import com.ledga.app.ui.components.v2.BentoCard
import com.ledga.app.ui.components.v2.LedgaTopBar
import com.ledga.app.ui.components.v2.onTonal
import com.ledga.app.ui.components.v2.ProgressRing
import com.ledga.app.ui.components.v2.TopBarIconButton
import com.ledga.app.ui.theme.LedgaAccent
@@ -115,7 +116,7 @@ private fun EmptyState() {
text = "Pick what you're saving toward and how you'll contribute. " +
"Ledga keeps the progress moving on its own — no manual entry.",
style = LedgaText.BodyM,
color = MaterialTheme.colorScheme.onSurface,
color = onTonal(LedgaAccentSoft),
)
}
}
@@ -38,6 +38,8 @@ import com.ledga.app.data.db.entity.InsightSeverity
import com.ledga.app.data.db.entity.InsightType
import com.ledga.app.ui.components.v2.BentoCard
import com.ledga.app.ui.components.v2.LedgaTopBar
import com.ledga.app.ui.components.v2.onTonal
import com.ledga.app.ui.components.v2.onTonalMuted
import com.ledga.app.ui.theme.LedgaAccent
import com.ledga.app.ui.theme.LedgaAccentDeep
import com.ledga.app.ui.theme.LedgaAccentSoft
@@ -108,6 +110,12 @@ private fun InsightCard(
onCta: () -> Unit,
) {
val tone = toneFor(insight.severity)
// Tonal cards have a FIXED light background in both light and dark themes,
// so their text must contrast with that background — not with the theme's
// surface (whose onSurface is near-white in dark mode → invisible here).
// INFO cards are non-tonal (adaptive surface), so they use theme colors.
val inkColor = if (tone.tonal) onTonal(tone.background) else MaterialTheme.colorScheme.onSurface
val mutedColor = if (tone.tonal) onTonalMuted(tone.background) else MaterialTheme.colorScheme.onSurfaceVariant
BentoCard(
tonal = tone.tonal,
tonalColor = tone.background,
@@ -131,13 +139,13 @@ private fun InsightCard(
Text(
text = insight.headline,
style = LedgaText.TitleS,
color = MaterialTheme.colorScheme.onSurface,
color = inkColor,
)
if (!insight.body.isNullOrBlank()) {
Text(
text = insight.body,
style = LedgaText.BodyM,
color = MaterialTheme.colorScheme.onSurfaceVariant,
color = mutedColor,
)
}
Row(
@@ -164,19 +172,19 @@ private fun InsightCard(
androidx.compose.material3.Icon(
imageVector = Icons.Filled.Replay,
contentDescription = "Snooze",
tint = MaterialTheme.colorScheme.onSurfaceVariant,
tint = mutedColor,
modifier = Modifier.size(14.dp),
)
Text(
text = "Snooze 30d",
style = LedgaText.Caption,
color = MaterialTheme.colorScheme.onSurfaceVariant,
color = mutedColor,
)
}
Text(
text = "Got it",
style = LedgaText.BodyM,
color = MaterialTheme.colorScheme.onSurface,
color = inkColor,
modifier = Modifier.clickable { onDismiss() },
)
}
@@ -40,6 +40,7 @@ import com.ledga.app.data.repository.DownloadState
import com.ledga.app.ui.components.v2.BackLeading
import com.ledga.app.ui.components.v2.BentoCard
import com.ledga.app.ui.components.v2.LedgaTopBar
import com.ledga.app.ui.components.v2.onTonal
import com.ledga.app.ui.theme.LedgaAccent
import com.ledga.app.ui.theme.LedgaAccentDeep
import com.ledga.app.ui.theme.LedgaAccentSoft
@@ -133,7 +134,7 @@ private fun UpToDateCard(onCheckAgain: () -> Unit) {
Text(
text = "Nothing newer on GitHub Releases right now.",
style = LedgaText.BodyM,
color = MaterialTheme.colorScheme.onSurface,
color = onTonal(LedgaAccentSoft),
)
TextButton(onClick = onCheckAgain) {
Text("Check again", color = LedgaAccentDeep)
@@ -177,7 +178,7 @@ private fun ReleaseCard(
Text(
text = "Currently running v${BuildConfig.VERSION_NAME} · Update is $sizeMb",
style = LedgaText.BodyM,
color = MaterialTheme.colorScheme.onSurface,
color = onTonal(LedgaAccentSoft),
)
}