Colton Idle
11/30/2021, 3:04 PMstyle = MaterialTheme.typography.h1,
but have the "h1" be a variable.
like
val myStyle = "h1"
then have
style = MaterialTheme.typography.+myStyle
Albert Chang
11/30/2021, 3:15 PMColton Idle
11/30/2021, 3:18 PMfun getColorFromString(color: String): Color {
when (color) {
"color1" -> { MyTheme.colors.color1 }
}
}
Colton Idle
11/30/2021, 3:29 PMChris Sinco [G]
11/30/2021, 6:09 PMColton Idle
11/30/2021, 6:48 PMChris Sinco [G]
11/30/2021, 6:59 PMColton Idle
11/30/2021, 7:19 PMMyTheme.colors.+"color1"
Albert Chang
12/01/2021, 12:19 AMColors
(or your custom colors class):
fun Colors.fromToken(token: ColorKey): Color = when (token) {
ColorKey.Primary -> primary
ColorKey.Secondary -> secondary
...
}