https://kotlinlang.org logo
#compose
Title
# compose
m

Mark

12/08/2023, 11:31 AM
When building an
AnnotatedString
how do you specify an alpha span without specifying the color?
Color.Unspecified.copy(alpha = alpha)
doesn’t work. Note, I’m not building the
AnnotatedString
in a Composable, so I don’t have access to
LocalTextStyle
BTW, I tried the other
SpanStyle
constructor that takes a
Brush
and
alpha
but that doesn’t seem to work (alpha ignored) when
Brush
is set to
null
. Judging by the docs, a non-null
Brush
is needed, but how to hack it for standard
Brush
behavior? Obviously, can’t use
SolidColor(color)
because I don’t have the color (and
Color.Unspecified
) doesn’t work there either.
s

saket

12/08/2023, 5:21 PM
Interesting. You could add string annotations to your text and apply the color later when you have access to a theme.
z

Zach Klippenstein (he/him) [MOD]

12/08/2023, 6:34 PM
We don’t currently support configuring the alpha separately from the rest of the color. Feel free to file a feature request
m

Mark

12/14/2023, 5:06 AM
I created a new issue, but for some reason got this:
New issue created: 316188062 (view access not granted)
z

Zach Klippenstein (he/him) [MOD]

12/14/2023, 5:34 PM
Weird, that bug just says the description has been deleted
oh it was flagged as abuse somehow
i unflagged, linking to this thread
thank you color 1
m

Mark

12/15/2023, 5:07 AM
The only thing I did differently from normal was to select the “Create / In Same Component” button, so it’s possible that it’s related to that.
z

Zach Klippenstein (he/him) [MOD]

12/15/2023, 5:28 AM
The component looked right. Idk what happened. Buganizer shmuganizer
😀 1
2 Views