Why `Color.White` doesn’t work? but other colors ...
# compose
t
Why
Color.White
doesn’t work? but other colors like
Color.Red
or
Color.Blue
works! 🧵
I am trying to change my
TextField
background color to white
Copy code
TextField(
        value = value,
        onValueChange = onValueChange,
        modifier = modifier.background(Color.White),
    )
but it doesn’t work. Any idea ? 🤔 (other colors work though)
a
Have you imported it ?
t
Yes.
z
What does “work” mean?
t
calling
.background(Color.White)
doesn’t do anything.
z
Does it work with BasicTextField? Some of the material components do some color matching and so if your theme has White in it i wonder if text field is doing something like that
t
ahh.. interesting. let me try with BasicTextField.
UPDATE: It works with
BasicTextField
.
z
Is there white in your theme?
t
Nope. Here’s a reproducible repo if you want : https://github.com/theapache64/WhiteIssue/
z
It looks like TextField has its own colors parameter and there's some color stuff in TextFieldDefaults. I guess that's the way to set the background color
t
yeah. i was confused why it doesn’t work for one specific color.
z
Me too. Not opening my laptop this weekend tho! 😜
☝🏽 1
😄 2
t
update: Replicable code moved to here