I defined color resources for Day and Night theme using values-night qualifier
values/colors.xml
<color name="icon_color">#282C3C/color>
values-night/colors.xml
<color name="icon_color">#FFFFFF/color>
I've vector drawable which uses color resource from theme values
android:fillColor="@color/icon_color"
I set this drawable using app:srcCompat="@drawable/wp_ic_camera" without any background or tint values and it uses AppCompatResources.getDrawable(view.context, drawableRes) in databinding to set the drawable
Users can choose the app theme to Light/Dark or System mode in App preference I update the theme using
val nightMode = when (theme) {
AppTheme.DARK -> AppCompatDelegate.MODE_NIGHT_YES
AppTheme.LIGHT -> AppCompatDelegate.MODE_NIGHT_NO
AppTheme.SYSTEM -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
AppCompatDelegate.setDefaultNightMode(nightMode)
The issue is when device theme is Dark and App theme is set to Light it follows System theme for drawable colors