fix(nests): wrap NestThemedScope in Surface so LocalContentColor flips
NestThemedScope painted `themed.background` on a plain Box. Compose's
`LocalContentColor` was never updated, so it stayed at its
CompositionLocal default — `Color.Black` — for every Text inside.
On the user's dark theme that meant black-on-black for the room
title and the chat panel: unreadable.
AmethystTheme installs `MaterialTheme(colorScheme = ...)` but does
NOT wrap content in a Surface; screens that use Scaffold inherit
LocalContentColor via Scaffold's internal Surface. NestFullScreen
goes Column → verticalScroll, no Scaffold, no Surface, so the
black-default fell through.
Replace the bare `Box.background(themed.background)` with a Material
Surface that paints `color = themed.background` AND provides
`contentColor = themed.onBackground` to LocalContentColor for the
inner subtree. The `bg` image still overlays the Surface inside the
Box, exactly as before.
This was the actual cause of the user's "title impossible to read /
chat super dark" report — the event in question shipped no `c` tags
(only the unparseable `["color", "gradient-7"]`), so RoomTheme was
already Empty. The previous "all-or-nothing palette" gate (commit
15169de7) is still right for half-applied palettes; this Surface
fix is what makes empty / un-themed rooms read correctly on dark.
https://claude.ai/code/session_01RDpuki4t8StSg1CZcXnV5b
This commit is contained in:
+22
-9
@@ -24,6 +24,7 @@ import androidx.compose.foundation.background
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Typography
|
import androidx.compose.material3.Typography
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -106,15 +107,26 @@ internal fun NestThemedScope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
MaterialTheme(colorScheme = themed, typography = themedTypography) {
|
MaterialTheme(colorScheme = themed, typography = themedTypography) {
|
||||||
// Paint the themed background COLOR on the Box itself so a room
|
// Wrap in a Surface so LocalContentColor flips to
|
||||||
// that ships `["c", hex, "background"]` but no `bg` image still
|
// `themed.onBackground` for everything inside content().
|
||||||
// visibly tints the room screen — without this, only consumers
|
// Without this, default Text() composables fall through to
|
||||||
// that explicitly read `MaterialTheme.colorScheme.background`
|
// CompositionLocal's default `Color.Black` and become
|
||||||
// would pick the override up, and the room would visually fall
|
// unreadable on dark theme — AmethystTheme installs
|
||||||
// back to the platform surface. The `bg` image, when present,
|
// MaterialTheme but doesn't itself wrap in a Surface, so any
|
||||||
// paints on top per EGG-10 rule 3 ("image overlays the color");
|
// screen that doesn't use Scaffold inherits that default.
|
||||||
// a partially-transparent image lets the color show through.
|
//
|
||||||
Box(modifier = Modifier.fillMaxSize().background(themed.background)) {
|
// Surface also paints the background color, which preserves
|
||||||
|
// the previous behavior (a room with `["c", hex, "background"]`
|
||||||
|
// visibly tints the screen). The `bg` image, when present,
|
||||||
|
// paints on top of Surface per EGG-10 rule 3 ("image overlays
|
||||||
|
// the color"); a partially-transparent image lets the color
|
||||||
|
// show through.
|
||||||
|
Surface(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
color = themed.background,
|
||||||
|
contentColor = themed.onBackground,
|
||||||
|
) {
|
||||||
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
theme.backgroundImageUrl?.let { url ->
|
theme.backgroundImageUrl?.let { url ->
|
||||||
when (theme.backgroundMode) {
|
when (theme.backgroundMode) {
|
||||||
RoomTheme.BackgroundMode.COVER -> {
|
RoomTheme.BackgroundMode.COVER -> {
|
||||||
@@ -135,6 +147,7 @@ internal fun NestThemedScope(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repeating-tile background. Compose's [AsyncImage] doesn't have a
|
* Repeating-tile background. Compose's [AsyncImage] doesn't have a
|
||||||
|
|||||||
Reference in New Issue
Block a user