{"id":19495443,"url":"https://github.com/guilhe/androidstyling-lintrules","last_synced_at":"2026-03-05T13:31:23.576Z","repository":{"id":57719843,"uuid":"272846800","full_name":"GuilhE/AndroidStyling-LintRules","owner":"GuilhE","description":"A set of lint rules to check for common mistakes when styling and theming on Android","archived":false,"fork":false,"pushed_at":"2022-08-29T17:19:32.000Z","size":771,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T03:41:14.469Z","etag":null,"topics":["android-colors","android-lint","android-lint-rule","android-style","android-theme","lint","lint-rules","material-colors","material-design"],"latest_commit_sha":null,"homepage":"https://guilhe.github.io/AndroidStyling-LintRules","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GuilhE.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":"https://www.buymeacoffee.com/GuilhE"}},"created_at":"2020-06-17T01:10:10.000Z","updated_at":"2022-08-29T17:16:54.000Z","dependencies_parsed_at":"2022-09-26T21:40:57.370Z","dependency_job_id":null,"html_url":"https://github.com/GuilhE/AndroidStyling-LintRules","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuilhE%2FAndroidStyling-LintRules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuilhE%2FAndroidStyling-LintRules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuilhE%2FAndroidStyling-LintRules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuilhE%2FAndroidStyling-LintRules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GuilhE","download_url":"https://codeload.github.com/GuilhE/AndroidStyling-LintRules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250900384,"owners_count":21505044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-colors","android-lint","android-lint-rule","android-style","android-theme","lint","lint-rules","material-colors","material-design"],"created_at":"2024-11-10T21:37:48.753Z","updated_at":"2026-03-05T13:31:23.382Z","avatar_url":"https://github.com/GuilhE.png","language":"Kotlin","readme":"# AndroidStyling-LintRules \n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndroidStyling--LintRules-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/8238)\n\nA set of lint rules to prevent us from the temptation of using HEX values or direct color resources instead of attributes, when creating our\n layouts either by xml or programmatically.  \nTo refresh your knowledge about theming colors: [Material Guidelines](https://material.io/develop/android/theming/color/). \n\n## Installation\n\nAndroidStyling-LintRules is distributed through [Maven Central](https://search.maven.org/artifact/com.github.guilhe/styling-lint) and [Jitpack](https://jitpack.io/#GuilhE/AndroidStyling-LintRules).\n\n```groovy\nimplementation 'com.github.guilhe:styling-lint:${LATEST_VERSION}'\n```\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.guilhe/styling-lint.svg)](https://search.maven.org/search?q=g:com.github.guilhe%20AND%20styling-lint)\n\n## Usage\n\nWell this is easy, your styles and layouts should always use attributes to get the color from the corresponding theme.  \nTherefore, in situations like:\n```xml\n\u003cTextView\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:textColor=\"@color/black\"/\u003e\n```\nYou'll get a warning advising you to change it:  \n\u003cimg src=\"https://raw.githubusercontent.com/GuilhE/AndroidStyling-LintRules/master/media/img1.png?token=AAUNTE3YJGFDS25GHHFEKBC64D4F2\" alt=\"Warning\" width=\"70%\"/\u003e\n\nThis rules are not exclusive for layouts:\n```java\ngetColor(R.color.colorPrimary)\n```\nYou'll also get a warning advising you to change it:  \n\u003cimg src=\"https://raw.githubusercontent.com/GuilhE/AndroidStyling-LintRules/master/media/img2.png?token=AAUNTE5UIPRKOGWF3LD5YO264D4IA\" alt=\"Warning\" width=\"70%\"/\u003e\n\nIn code situations, getting a color from a theme is not that trivial and it involves a bit of boilerplate code.  \nFor that reason, [ResourcesProvider-ktx](https://github.com/GuilhE/ResourcesProvider-ktx) may come in hand. It's a helper class to provide\n resources and it has [\"themes support\"](https://github.com/GuilhE/ResourcesProvider-ktx#themes):\n   \n```java\n.setBackgroundColor(resourcesProvider.colorRes(R.attr.colorPrimary, R.style.App_Style_A)\n```  \n  \n## Bugs and Feedback\n\nFor bugs, questions and discussions please use the [Github Issues](https://github.com/GuilhE/AndroidStyling-LintRules/issues).\n\n## LICENSE\n\nCopyright (c) 2020-present GuilhE\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","funding_links":["https://www.buymeacoffee.com/GuilhE"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilhe%2Fandroidstyling-lintrules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguilhe%2Fandroidstyling-lintrules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilhe%2Fandroidstyling-lintrules/lists"}