https://kotlinlang.org logo
#compose
Title
# compose
a

AmrJyniat

09/20/2022, 8:42 AM
Can I color the same Composable(Card) in multiple colors, if I have three colors then I want to color the card by these three colors equality, any idea?
e

efemoney

09/20/2022, 8:43 AM
Use a gradient
Copy code
Brush,horizontalGradient(
  0.0f to cyan,
  0.5f to cyan,
  0.5f to lightBrown,
  1.0f to lightBrown,
  ...
)
You would do some calculation for
n
number of sections but the idea remains the same. Using a gradient, spread the color stops based on
n
a

AmrJyniat

09/20/2022, 8:52 AM
Using gradient is an elegant idea that didn't come to my brain so sure I'll try it and come back, Thanks!
2 Views