I know that with Jetpack Compose I can define colors in Kotlin files. Since I'm migrating an app that used not to use Jetpack Compose, I'd like to keep pointing to the colors in the XML until I get rid of all the places when I'm already using them.
I know that I can use colorResource in a @Composable function but I can't do it when I define the palette in a Kotlin file.
Is it possible to do something equivalent to this?
private val DarkColorPalette = darkColors(
primary = colorResource(id = R.color.company),
...
)
The way I did it is by using @Composable functions even for the definitions of the colors:
@Composable
fun darkColorPalette() = darkColors(
primary = colorResource(id = R.color.company),
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With