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))
}