I am doing a multiplatform project, and I am defin...
# compose
d
I am doing a multiplatform project, and I am defining the color pallette in the shared view model. Is there a simple function to convert the 6-char RGB string (e.g. “CC6699”) into a 
androidx.compose.ui.graphics.Color
 object ?
For the moment, I decided to write an extension function:
Copy code
fun String.toColor() : Color {
    return Color(("FF"+this).toLong(16))
}
d
You can define colors using Long, like this
Copy code
val pink = 0xFFE83E62
That way you can skip String to Long conversion