Are there any known problems with dark mode not be...
# compose
f
Are there any known problems with dark mode not being displayed correctly on some devices? My whole app is wrapped in a
Surface
but the text doesn't always have the correct color in dark mode for some people (it works on my testing devices)
o
Its not related to Surface in particular. I had the same problem on devices with MIUI. To resolve this issue we set android:forceDarkAllowed=false in the theme for API 29+. My guess is that some devices with MIUI ignore app’s configuration for dark mode and just trying to blindly force dark mode on your views.
f
@Oleksii Yerastov good point, I'll try that
You set that in the
themes.xml
, right?
and does it affect Compose's properly implemented dark mode in any way?
o
Yeah, in themes.xml No it does not affect compose in any way, just restricts the system to apply dark mode by forcing colors that system pick by itself based on analysis of content of View hierarchy.
f
Thank you, I'll add that!
do I need to add all attributes in themes.xml for API 29+ or only the ones I want to add?
o
29+ because dark mode was introduced with 29 API and forceDarkAllowed works starting with this API level
f
yea I just noticed that
o
You just need to add forceDarkAllowed for 29+, other attributes will be taken from general themes.xml file
f
Are you sure? But I'm defining the whole style in there right
I think I have to add all attributes
I guess I can avoid duplicating all the attributes by creating a child theme