Fix Hard-to-Read Dark Mode Text in Jetpack Compose
← BACK TO WRITING
November 8, 2026

By , Android developer & software engineer

Fix Hard-to-Read Dark Mode Text in Jetpack Compose

Diagnose a faded Material 3 card, pair its foreground and background colors, and check the result in both light and dark mode.

A Compose card looks fine on the emulator until you switch to dark mode. Its background changes, but the subtitle all but disappears. Before adjusting the gray by eye, check which component owns the background and where the subtitle gets its text color. Often those two decisions were made in different files.

Start with a reproducible screen: one reading-list card containing a title, a subtitle, and a saved indicator. If the project doesn't yet have separate light and dark schemes, begin with the Material 3 theme walkthrough.

Keep the colors together

A common mistake is setting a theme-aware container while drawing text with a hardcoded dark gray. Use a matching pair from the color scheme. Here is a small card body you can place inside a themed composable:

val colors = MaterialTheme.colorScheme
Surface(
    color = colors.surfaceVariant,
    contentColor = colors.onSurfaceVariant
) {
    Column(Modifier.padding(16.dp)) {
        Text("Reading list", style = MaterialTheme.typography.titleMedium)
        Text("3 articles saved", style = MaterialTheme.typography.bodyMedium)
    }
}

Both text elements inherit the surface's content color. The difference in emphasis comes from typography. If a child explicitly sets its own color or alpha, inspect that override too. Lowering opacity blends the text into its background and can undo the benefit of choosing the right pair.

Check the pixels readers actually see

Take screenshots in both themes at the same font size. Measure the foreground and background of the subtitle with a contrast checker, using the solid interior of a letter rather than its antialiased edge. Android's accessibility guidance recommends at least 4.5:1 for ordinary small text. A palette named “accessible” is not a measurement of the rendered card.

Try the saved indicator in grayscale. If readers can tell saved from unsaved only because one dot is green, add a text label or a distinct icon with an accessible state description. Finally, enlarge the system font and inspect the subtitle again. Strong contrast fixes one problem; it won't rescue a label clipped by a fixed-height container.

Keep this small card as a repeatable check when changing the theme. One representative screen in both modes is more useful than a page of swatches with no text on them.

© 2026 SHAKIL AHMED. SYSTEM: ANTIGRAVITY OS v1.0