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

Ali Albaali

11/15/2020, 1:37 PM
Is there a way to parse a string to Color in Compose? 🤔
p

Pavel Marchenko

11/15/2020, 2:16 PM
Hi, what about:
Copy code
val color = Color(java.lang.Long.decode("0x4200FF00"))
val color3 = Color(java.lang.Long.decode("#4200FF00"))
val color2 = Color("4200FF00".toLong(radix = 16))
🙏 1
k

Kshitij Patil

11/15/2020, 4:49 PM
I found this
Copy code
val String.color
get() = Color(android.graphics.Color.parseColor(this))
from rajandev17/*Plasma*
42 Views