Jetpack Compose Preview background color is different from theme background color

571 views Asked by At

I'm just learnig Compose. I want to make Compose Preview background color setting the same as run app mode. What is wrong with my code?

Preview code

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    PreviewTutorialTheme {
        Surface(
            modifier = Modifier.fillMaxSize(),
            color = MaterialTheme.colorScheme.background
        ) {
            Greeting("Android")
        }
    }
}

Theme.kt Color code

private val DarkColorScheme = darkColorScheme(
    primary = Purple80,
    secondary = PurpleGrey80,
    tertiary = Pink80
)

private val LightColorScheme = lightColorScheme(
    primary = Purple40,
    secondary = PurpleGrey40,
    tertiary = Pink40,
    background = Color.Red

Preview image and Run app image enter image description here

I want make Preview theme setting same as run app.

0

There are 0 answers