We're trying to make our app able to both look good (via Android Studios' themes) on both light UI and dark UI modes on Android 10.
The light theme works fine, and it applies the primary and primary accent colors fine. The issue comes with the dark theme. If dark mode is activated on the phone (Xiaomi Mi 9 updated to MIUI 12), then the colors just become a darker shade, even though we have set the same primary and accent colors on the dark theme file as well. Even constant colors that we have applied with "@colors/name_of_color" darken (and from my understanding this shouldn't happen at all).
Here are our theme files:
theme.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.DynaswayConcussion" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/main_green</item>
<item name="colorPrimaryVariant">@color/main_green</item>
<item name="colorOnPrimary">@color/main_gray</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.DynaswayConcussion.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.DynaswayConcussion.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.DynaswayConcussion.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
theme.xml (night)
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.DynaswayConcussion" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/main_green</item>
<item name="colorPrimaryVariant">@color/main_green</item>
<item name="colorOnPrimary">@color/main_gray</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.DynaswayConcussion.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.DynaswayConcussion.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="Theme.DynaswayConcussion.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark" />
</resources>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="accent_green">#377854</color>
<color name="main_green">#66d999</color>
<color name="main_gray">#4d4543</color>
<color name="main_pink">#d971cd</color>
<color name="accent_pink">#fadadd</color>
<color name="chart_baseline">#ebd810</color>
<color name="chart_test">#d13e11</color>
</resources>
We're using AppCompatActivity and Fragment to develop the screens for the application, and we're not directly applying colors on any buttons (those become a really dark shade of green). We're only applying background colors directly to some backgrounds on cards (accent_pink color) and even those darken.
Is this an issue with MIUI? Or is this an issue with our configuration?