I am migrating my app's Material Design theme from V2 (1.4.0) to V3 (1.5.0).
Unlike Theme.MaterialComponents.DayNight
, which had a DarkActionBar sub style that used the Primary color for the Action Bar, Theme.Material3.DayNight
doesn't have DarkActionBar sub style.
I can't figure out what color is used for the Action Bar in the default settings.
This is how my current app theme shows up:
As can be seen, my Primary color is Blue, but the Action Bar has automatically been colored using a shade/alpha of the primary. The hexadecimal color notation of the Action Bar was not defined by me. I tried setting the Status Bar to all the various shades of blue that I defined in my colors.xml file, but none of them are a perfect match.
Can someone explain how is the Action Bar color determined or how I may be able to set the Status Bar to the same color as the Action Bar?
colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#000000</color>
<color name="white">#ffffff</color>
<color name="black_alpha_020">#33000000</color>
<color name="white_alpha_060">#99ffffff</color>
<color name="blue_50">#e3f2fd</color>
<color name="blue_50_bit_black">#E4F0F5</color>
<color name="blue_100">#bbdefb</color>
<color name="blue_300">#64b5f6</color>
<color name="blue_500">#2196f3</color>
<color name="blue_700">#1976d2</color>
<color name="blue_a100">#82b1ff</color>
<color name="blue_black_3_3">#072451</color>
<color name="blue_black_3_3_bit_black">#031228</color>
<color name="blue_white_5_6">#fafdff</color>
<color name="blue_black_5_6">#061929</color>
<color name="blue_black_10_2">#CEDCE6</color>
<color name="blue500_black_5_6">#26282A</color>
<color name="blue_50_alpha_060">#99e3f2fd</color>
<color name="blue_grey_700">#455a64</color>
<color name="blue_grey_800">#37474f</color>
<color name="amber_100">#ffecb3</color>
<color name="amber_700">#ffa000</color>
<color name="amber_black_3_4">#401C00</color>
<color name="red_50">#ffebee</color>
<color name="red_black_2_3">#3D0909</color>
<color name="red_900">#b71c1c</color>
<color name="grey_600">#757575</color>
</resources>
themes.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.SimpleTheme" parent="Theme.Material3.DayNight">
<!--Color-->
<item name="colorPrimary">@color/blue_500</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorPrimaryContainer">@color/blue_50</item>
<item name="colorOnPrimaryContainer">@color/blue_black_3_3</item>
<item name="colorSecondary">@color/blue_grey_800</item>
<item name="colorOnSecondary">@color/white</item>
<item name="colorSecondaryContainer">@color/blue_50_bit_black</item>
<item name="colorOnSecondaryContainer">@color/blue_black_3_3_bit_black</item>
<item name="colorTertiary">@color/amber_700</item>
<item name="colorOnTertiary">@color/white</item>
<item name="colorTertiaryContainer">@color/amber_100</item>
<item name="colorOnTertiaryContainer">@color/amber_black_3_4</item>
<item name="colorError">@color/red_900</item>
<item name="colorOnError">@color/white</item>
<item name="colorErrorContainer">@color/red_50</item>
<item name="colorOnErrorContainer">@color/red_black_2_3</item>
<item name="android:colorBackground">@color/blue_white_5_6</item>
<item name="colorOnBackground">@color/blue_black_5_6</item>
<item name="colorSurface">@color/blue_white_5_6</item>
<item name="colorOnSurface">@color/blue_black_5_6</item>
<item name="colorSurfaceVariant">@color/blue_black_10_2</item>
<item name="colorOnSurfaceVariant">@color/blue500_black_5_6</item>
<item name="colorOutline">@color/grey_600</item>
<item name="colorSurfaceInverse">@color/blue_black_5_6</item>
<item name="colorOnSurfaceInverse">@color/blue_white_5_6</item>
<item name="colorPrimaryInverse">@color/blue_a100</item>
<item name="android:navigationBarColor" tools:targetApi="o_mr1">?attr/colorSurface</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
</style>
<style name="Theme.SimpleTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>