mirror of
https://github.com/andwati/ledga.git
synced 2026-10-18 03:12:55 +00:00
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:
@@ -27,8 +27,8 @@ android {
|
|||||||
applicationId = "com.ledga.app"
|
applicationId = "com.ledga.app"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 14
|
versionCode = 15
|
||||||
versionName = "1.4.4"
|
versionName = "1.4.5"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
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.Avatar
|
||||||
import com.ledga.app.ui.components.v2.BackLeading
|
import com.ledga.app.ui.components.v2.BackLeading
|
||||||
import com.ledga.app.ui.components.v2.BentoCard
|
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.LedgaChip
|
||||||
import com.ledga.app.ui.components.v2.LedgaTopBar
|
import com.ledga.app.ui.components.v2.LedgaTopBar
|
||||||
import com.ledga.app.ui.theme.LedgaAccent
|
import com.ledga.app.ui.theme.LedgaAccent
|
||||||
@@ -287,7 +288,7 @@ fun BackfillScreen(
|
|||||||
"Account row at the bottom that lets you reassign one row " +
|
"Account row at the bottom that lets you reassign one row " +
|
||||||
"at a time. Useful for stragglers.",
|
"at a time. Useful for stragglers.",
|
||||||
style = LedgaText.BodyM,
|
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.BackLeading
|
||||||
import com.ledga.app.ui.components.v2.BentoCard
|
import com.ledga.app.ui.components.v2.BentoCard
|
||||||
import com.ledga.app.ui.components.v2.LedgaTopBar
|
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.ProgressRing
|
||||||
import com.ledga.app.ui.components.v2.TopBarIconButton
|
import com.ledga.app.ui.components.v2.TopBarIconButton
|
||||||
import com.ledga.app.ui.theme.LedgaAccent
|
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. " +
|
text = "Pick what you're saving toward and how you'll contribute. " +
|
||||||
"Ledga keeps the progress moving on its own — no manual entry.",
|
"Ledga keeps the progress moving on its own — no manual entry.",
|
||||||
style = LedgaText.BodyM,
|
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.data.db.entity.InsightType
|
||||||
import com.ledga.app.ui.components.v2.BentoCard
|
import com.ledga.app.ui.components.v2.BentoCard
|
||||||
import com.ledga.app.ui.components.v2.LedgaTopBar
|
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.LedgaAccent
|
||||||
import com.ledga.app.ui.theme.LedgaAccentDeep
|
import com.ledga.app.ui.theme.LedgaAccentDeep
|
||||||
import com.ledga.app.ui.theme.LedgaAccentSoft
|
import com.ledga.app.ui.theme.LedgaAccentSoft
|
||||||
@@ -108,6 +110,12 @@ private fun InsightCard(
|
|||||||
onCta: () -> Unit,
|
onCta: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val tone = toneFor(insight.severity)
|
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(
|
BentoCard(
|
||||||
tonal = tone.tonal,
|
tonal = tone.tonal,
|
||||||
tonalColor = tone.background,
|
tonalColor = tone.background,
|
||||||
@@ -131,13 +139,13 @@ private fun InsightCard(
|
|||||||
Text(
|
Text(
|
||||||
text = insight.headline,
|
text = insight.headline,
|
||||||
style = LedgaText.TitleS,
|
style = LedgaText.TitleS,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = inkColor,
|
||||||
)
|
)
|
||||||
if (!insight.body.isNullOrBlank()) {
|
if (!insight.body.isNullOrBlank()) {
|
||||||
Text(
|
Text(
|
||||||
text = insight.body,
|
text = insight.body,
|
||||||
style = LedgaText.BodyM,
|
style = LedgaText.BodyM,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = mutedColor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
@@ -164,19 +172,19 @@ private fun InsightCard(
|
|||||||
androidx.compose.material3.Icon(
|
androidx.compose.material3.Icon(
|
||||||
imageVector = Icons.Filled.Replay,
|
imageVector = Icons.Filled.Replay,
|
||||||
contentDescription = "Snooze",
|
contentDescription = "Snooze",
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
tint = mutedColor,
|
||||||
modifier = Modifier.size(14.dp),
|
modifier = Modifier.size(14.dp),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = "Snooze 30d",
|
text = "Snooze 30d",
|
||||||
style = LedgaText.Caption,
|
style = LedgaText.Caption,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = mutedColor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = "Got it",
|
text = "Got it",
|
||||||
style = LedgaText.BodyM,
|
style = LedgaText.BodyM,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = inkColor,
|
||||||
modifier = Modifier.clickable { onDismiss() },
|
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.BackLeading
|
||||||
import com.ledga.app.ui.components.v2.BentoCard
|
import com.ledga.app.ui.components.v2.BentoCard
|
||||||
import com.ledga.app.ui.components.v2.LedgaTopBar
|
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.LedgaAccent
|
||||||
import com.ledga.app.ui.theme.LedgaAccentDeep
|
import com.ledga.app.ui.theme.LedgaAccentDeep
|
||||||
import com.ledga.app.ui.theme.LedgaAccentSoft
|
import com.ledga.app.ui.theme.LedgaAccentSoft
|
||||||
@@ -133,7 +134,7 @@ private fun UpToDateCard(onCheckAgain: () -> Unit) {
|
|||||||
Text(
|
Text(
|
||||||
text = "Nothing newer on GitHub Releases right now.",
|
text = "Nothing newer on GitHub Releases right now.",
|
||||||
style = LedgaText.BodyM,
|
style = LedgaText.BodyM,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = onTonal(LedgaAccentSoft),
|
||||||
)
|
)
|
||||||
TextButton(onClick = onCheckAgain) {
|
TextButton(onClick = onCheckAgain) {
|
||||||
Text("Check again", color = LedgaAccentDeep)
|
Text("Check again", color = LedgaAccentDeep)
|
||||||
@@ -177,7 +178,7 @@ private fun ReleaseCard(
|
|||||||
Text(
|
Text(
|
||||||
text = "Currently running v${BuildConfig.VERSION_NAME} · Update is $sizeMb",
|
text = "Currently running v${BuildConfig.VERSION_NAME} · Update is $sizeMb",
|
||||||
style = LedgaText.BodyM,
|
style = LedgaText.BodyM,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = onTonal(LedgaAccentSoft),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user