I am reading dominat color using palette from an i...
# compose
m
I am reading dominat color using palette from an image. I want to place a background with that color, and text inside. How can i check if the color is predominantly light/dark so i can change textColor to white/black. Is there any build-in feature for this ?
a
You can check the color's luminance:
Copy code
val isLight = color.luminance() > 0.5
c
Out of curiosity. I will hit this problem in a few months, but ss palette still the library to use? I thought it was deprecated?
a
Why? It is even used in the official compose samples.