From e6a5ba9e15abf1e07eabbf9d0917bcd5372595dd Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 19:46:39 +0000 Subject: [PATCH] fix: use theme background when ShowMore gradient color is transparent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several callers pass Color.Transparent as the rich-text backgroundColor. getGradient was copying that color and forcing alpha=1, which produced opaque black (Color(0,0,0,1)) as the gradient end — so on a light theme the fade behind the "Show more" button looked pitch black. Fall back to MaterialTheme.colorScheme.background when the supplied background has alpha 0, so the gradient fades from transparent into the actual surface color. --- .../amethyst/ui/note/NoteCompose.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index f56c0137e5..fe6699eb94 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -1484,14 +1484,22 @@ fun RenderRepost( } } -fun getGradient(backgroundColor: MutableState): Brush = - Brush.verticalGradient( +@Composable +fun getGradient(backgroundColor: MutableState): Brush { + val solid = + if (backgroundColor.value.alpha == 0f) { + MaterialTheme.colorScheme.background + } else { + backgroundColor.value.copy(alpha = 1f) + } + return Brush.verticalGradient( colors = listOf( - backgroundColor.value.copy(alpha = 0f), - backgroundColor.value.copy(alpha = 1f), + solid.copy(alpha = 0f), + solid, ), ) +} @Composable fun ReplyNoteComposition(