Is it possible that applying ```val colorModifier...
# compose
p
Is it possible that applying
Copy code
val colorModifier = Modifier.background(CustomColor)
in a Surface
Copy code
Surface(modifier = colorModifier) {...}
Show a different color than in a Box
Copy code
Box(modifier = colorModifier) {...}
Not sure what could be the reason behind it but I am having this behavior where the color on the surface looks a bit more whitish. For a bit more context. It is a Composable very deep in the Composable tree, a leaf in the tree basically.
s
As far as I know, Surface is a Material Design system component that applies an elevation color tint. This tint visually represents elevation by adding a subtle color overlay that enhances depth perception.
🤔 1
👀 1
👍 1
p
Humm, interesting. I swear god Surface was a compose-foundation thing but what you say matches exactly the behavior I am seeing. I am applying shadow too. So it could change things as well.
z
You can just look at the package of the Surface function, it’s definitely material
It also uses material theming
👍 2
1
j
I had the same 'problem'. In my case 'surfaceContainerHighest' was the right ColorScheme parameter name. https://m3.material.io/styles/color/roles
n
have you fixed you issue ?
p
I replaced the Surface with a Box
n
yes it's possible