androidmaterial3material-you

Material3 - How to access the hex color values?


I recently updated my Android Studio version to the newest one (giraffe) and I noticed the themes.xml is now changed and does not give you the colors (teal and purple) like it would in previous versions.

enter image description here

But once I ran the newly created app, I noticed the status bar has a purple color.

enter image description here

How can I access the colors in this theme? And how can I get the exact hex colors used?


Solution

  • I had the same problem, but I was only able to override theme in the themes.xml using somethings like:

    <item name="colorOnSurface">@color/white</item>
    <item name="android:navigationBarColor">@color/colorPrimaryVariant</item>
    <!-- Status bar color. -->
    <item name="android:statusBarColor" >?attr/colorPrimaryVariant</item>
    

    And my in colors.xml I had

    <color name="colorPrimaryVariant">#1F2326</color>
    

    I have also tried locating the Material3 colors.xml and values.xml and I found them under

    ..\.jdks\openjdk-15.0.2\caches\transforms-3\3b89e20d8303563adc73b801dcf3de9c\transformed\material-1.9.0\res\values