Reputation: 369
I am really interested in making my app meet the new material.io guidelines. While going trough the docs of material.io, i wanted to try the palette on my app. The palette creates a primary and secondary color and also the light and dark descendant colors. Now this confuses me: When I want to use these colors with my android material app, I came across the fact that android styles, including the com.google.android.material
library, only accept a few colors for the apptheme:
<!--from android default:-->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorSecondary">@color/colorSecondary</item>
<!-- added by the google material library:-->
<item name="colorPrimaryVariant">@color/colorPrimaryVariant</item>
<item name="colorSecondaryVariant">@color/colorSecondaryVariant</item>
Now as you can see, there only is the possibility to add the main palette colors, but mostly you can't add light or dark variants to your apptheme. How can I properly apply the guideline color system to my app, if the above seems not to meet the color system standards?
Upvotes: 0
Views: 346
Reputation: 8006
The MDC Android library set the baseline material color theme: https://material.io/design/color/the-color-system.html#color-theme-creation
If you need additional color slots for your theme, you will have to create new attributes to represent those themed colors, and update styles on a component by component basis to use those new attributes.
You can see all the attributes that were added here (Some attributes such as colorPrimary are used but they were already defined in AppCompat so they aren't redefined in that file)
Upvotes: 1