A set of lint rules that keep us from using HEX values or direct color resources instead of attributes when we create our layouts either via XML or programmatically.
How to Update Your Knowledge of Theme Colors: Material Guidelines.
AndroidStyling LintRules is sold through Maven Central, Jcenter and Jitpack.
Well that’s easy. Your styles and layouts should always use attributes to get the color out of the appropriate theme.
Hence in situations like:
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/black"/>
You will get a warning asking you to change it:
These rules don’t apply to layouts only:
You will also get a warning asking you to change these:
In code situations, getting a color from a theme isn’t that trivial, and it involves a bit of code on the boiler plate.
For this reason, ResourcesProvider-ktx can come into hand. It is an auxiliary class for providing resources and has “topic support”:
Bugs and feedback
For bugs, questions, and discussions, please use the Github issues.
Copyright (c) GuilhE until 2020
Licensed under the Apache License, Version 2.0 (the “License”); You may only use this file in accordance with the license. You can get a copy of the license at
Unless required by law or agreed in writing, the software distributed under the license is distributed “AS IS” without any warranty or condition, express or implied, of any kind. In the license, you can find the specific language for permissions and restrictions under the license.