mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-08 23:54:39 +00:00
fix: use theme background when ShowMore gradient color is transparent
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.
This commit is contained in:
@@ -1484,14 +1484,22 @@ fun RenderRepost(
|
||||
}
|
||||
}
|
||||
|
||||
fun getGradient(backgroundColor: MutableState<Color>): Brush =
|
||||
Brush.verticalGradient(
|
||||
@Composable
|
||||
fun getGradient(backgroundColor: MutableState<Color>): 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(
|
||||
|
||||
Reference in New Issue
Block a user