Material3 Theme Builder - can't get all colors from preview

73 Views Asked by At

So I'm trying to use the following link to build theme for an app:

https://m3.material.io/theme-builder#/custom

But I can't figure out the following color of the container:

enter image description here

It's not listed anywhere and I'm trying to set the same color for cards in my app.

Does anybody know?

upd: it looks something like MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp) but still the color code is a little bit different, 1.dp is the closest one to get the similar color, but mb it's actually the right answer, just a little difference between implementation of the web preview and a real app with jetpack Compose Material 3

2

There are 2 best solutions below

0
user924 On

Actually, yeah, it should be MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp).

I tried different colors on the web site and then in my app and finally they matched - I have been using "Screen ColorPicker (HEX)" software for Windows to get code from web site and Jetpack Compose previews

5
Philio On

If you used the theme generated from the website, the Card colour is using the colour defined by md_theme_light_surfaceVariant or md_theme_dark_surfaceVariant for dark mode.

From material theme it's MaterialTheme.colorScheme.surfaceVariant