Is there a function or something to change the alp...
# compose
y
Is there a function or something to change the alpha variable of a
Color
? It is val so cannot be modified. To change it I had to create my custom extension function:
Copy code
fun Color.updateAlpha(newAlpha: Float) =
    Color(red = red, blue = blue, green = green, colorSpace = colorSpace, alpha = newAlpha)
r
copy
. Like:
Color.Blue.copy(alpha = 0.5f)
y
oh, you can set new variables on
copy
? Idk how I missed that 😧 thanks
r
@YASAN You're welcome. These APIs these days are exceeding the capacity of one human brain to deal with. I forget stuff all the time. Especially when I need to work in multiple ecosystems (Apple, Android, web). I'm constantly fighting the push to be jack of all trades, master of none. Anyway, end of mini-rant. 🙂
😪 1
a
It's basically mimicking the copy method of data class.