Material Design Specs Library
Along with the RecyclerViewCursorAdapter library that was released earlier this week, I have now released my second open source Android library. In collaboration with my good friend Maurício, we have built a library for including the Material Design Specs in your Android application. Currently, the library has the full color palette along with some helper methods, and some elevation resources to give the proper elevation to your components. The source code, as well as instructions for including the library can be found on GitHub, so go there to check it out and give us a star!
The convention for accessing the color resources is like so:
where colorName and colorLevel are replaced with the values you want. There are 19 color names:
And there are 14 color levels:
The ones prefixed with an A represent accent shades. Please note that brown, grey, and bluegray do not have accent shades with them. With that, an example of a color may be
Available helper methods include:
Each of these methods will throw an IllegalAccessException if any of the resources are unable to be accessed. For passing in the color name or color level, you can make use of the available static strings, such as:
Currently the only supported elevation values are those found from the elevation specs that follow convention:
where componentNAme can be replaced by “dialog” or “appbar”. With its current functionality, there is no need for programatic helper methods for using elevation values. This may change as more specs are included in the future.
We hope this gives you everything you need for moving forward and incorporating Material Design in your applications. If you feel like our library is missing anything, let us know in the comments or submit an issue on GitHub!