code-connect
code-connect copied to clipboard
[Compose] Mapping Colors and Dimensions
Hello 👋 I'm trying to figure out how to pass color and dimensions (dp) as properties in my Figma mapping file.
Context:
- I'm an Android Developer and I'm trying to do this with Jetpack Compose
- I have Colors and Dimensions set up as Variables in my design system in Figma
Here is an example of the button I'm trying to map:
The parameters I'm having trouble with are backgroundColor, textColor, and borderWidth.
@Composable
fun MyButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
backgroundColor: Color = MyColor.Blue,
textColor: Color = MyColor.White,
borderWidth: Dp = 1.dp,
) { ... }
object MyColor {
val Blue = Color(0xFF0070C8)
val White = Color(0xFFFFFFFF)
val Green = Color(0xFF057E54)
}