https://kotlinlang.org logo
#compose-web
Title
# compose-web
e

Erik

10/06/2022, 3:40 PM
If I want to apply a color to some element, can I modify only one of its color properties? E.g. it might have RGB color
(r, g, b)
, and I only want to set
a = 0.3
. Is there a way to simply set A, without changing RGB? (Or, more advanced, is there a way to transform RGBA by multiplying it with a vector of RGBA factors? For example, to reduce alpha to 30% of its current value, I'd multiply by [1, 1, 1, 0.3].)
Found it:
opacity(0.3)
does what I want.
2 Views