Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background color is light even in dark mode. #12

Closed
p0ppy-fl0w3r opened this issue Jan 6, 2023 · 5 comments
Closed

Background color is light even in dark mode. #12

p0ppy-fl0w3r opened this issue Jan 6, 2023 · 5 comments
Labels
question Further information is requested

Comments

@p0ppy-fl0w3r
Copy link

The background color doesn't seem to change to a darker color even if the device is in dark mode. My surface color is 0xFF26282F but the dialog is shown in a 'white' color.

Screenshot_20230106_160604_Hydro Bro (1) Screenshot_20230106_160617_Hydro Bro

@maxkeppeler
Copy link
Owner

On first sight, in the file DialogBase the Surface is used to wrap the use-case layout in it.
Surface uses as background MaterialTheme.colorScheme.surface

Can u maybe show your theme setup? Right now, it's difficult to guess what the problem could be.

@maxkeppeler maxkeppeler added the question Further information is requested label Jan 15, 2023
@p0ppy-fl0w3r
Copy link
Author

Sure!

Here's the color palette

val Blue500 = Color(0xFF1E80B9)
val DarkBlue900 = Color(0xFF26282F)

// The app is always in dark mode regardless of the user's system theme.
val ColorPalette = darkColors(
    primary = Blue500,
    surface = DarkBlue900,
    onSurface = Color.White,
    background = DarkBlue900,
    onBackground = Color.White
)

... and the app's theme.

@Composable
fun MyTheme(content: @Composable () -> Unit) {

    MaterialTheme(colors = ColorPalette, typography = Typography, content = content)
}

In addition to the code above, I've added android:windowBackground=@color/black to my res/values/theme.xml to make the background color of my splash screen black. Here's the entirety of the theme.xml file.

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="Theme.MyApp" parent="android:Theme.Material.Light.NoActionBar" >
        <item name="android:windowBackground">@color/black</item>
    </style>
</resources>

@maxkeppeler
Copy link
Owner

maxkeppeler commented Jan 20, 2023

Are you using MD2 or MD3? Perhaps same problem then, as for issue #15

@p0ppy-fl0w3r
Copy link
Author

Yep... I'm using MD2. Thankx for this awesome library tho : )

@maxkeppeler
Copy link
Owner

Sorry for the issue then. I will definitely look into supporting MD2 as separate dependencies in the future, alongside landscape Layouts, once I find more time! Thank you!

@maxkeppeler maxkeppeler closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants