Theme: every typography tier + LocalContentColor carry explicit palette ink; root Surface transparency made Compose's black default visible-on-dark text (fix unresolved foundation.LocalContentColor -> material3)

This commit is contained in:
avi 2026-09-21 16:25:21 -05:00
commit 81f9855c1f

View file

@ -313,17 +313,29 @@ fun ShonarTheme(
content: @Composable () -> Unit, content: @Composable () -> Unit,
) { ) {
val palette = if (mode == ThemeMode.LIGHT) LightPalette else DarkPalette val palette = if (mode == ThemeMode.LIGHT) LightPalette else DarkPalette
// Muted tiers carry secondary/muted ink per palette (call sites may // Every typography tier carries explicit per-palette ink: a TextStyle
// still override with an explicit color). // with no color falls back to Compose's default BLACK, which is
// invisible on the dark canvas (regression seen Sep 21). Call sites
// may still override with an explicit color.
val typography = androidx.compose.runtime.remember(palette) { val typography = androidx.compose.runtime.remember(palette) {
ShonarTypography.copy( ShonarTypography.copy(
headlineSmall = ShonarTypography.headlineSmall.copy(color = palette.textPrimary),
titleMedium = ShonarTypography.titleMedium.copy(color = palette.textPrimary),
titleSmall = ShonarTypography.titleSmall.copy(color = palette.textPrimary),
bodyLarge = ShonarTypography.bodyLarge.copy(color = palette.textPrimary),
bodyMedium = ShonarTypography.bodyMedium.copy(color = palette.textPrimary),
bodySmall = ShonarTypography.bodySmall.copy(color = palette.textSecondary), bodySmall = ShonarTypography.bodySmall.copy(color = palette.textSecondary),
labelLarge = ShonarTypography.labelLarge.copy(color = palette.textPrimary),
labelMedium = ShonarTypography.labelMedium.copy(color = palette.textSecondary), labelMedium = ShonarTypography.labelMedium.copy(color = palette.textSecondary),
labelSmall = ShonarTypography.labelSmall.copy(color = palette.textMuted), labelSmall = ShonarTypography.labelSmall.copy(color = palette.textMuted),
) )
} }
androidx.compose.runtime.CompositionLocalProvider( androidx.compose.runtime.CompositionLocalProvider(
Shonar.LocalPalette provides palette, Shonar.LocalPalette provides palette,
// The root Surface went transparent for the meridian gradient;
// provide the ink explicitly so LocalContentColor can't fall
// back to Compose's black default on the dark canvas.
androidx.compose.material3.LocalContentColor provides palette.textPrimary,
) { ) {
MaterialTheme( MaterialTheme(
colorScheme = schemeFor(palette), colorScheme = schemeFor(palette),