Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathiazhagan01/DrawableColorChange
Android Library to dynamically change color of drawable.
https://github.com/mathiazhagan01/DrawableColorChange
android-library bitmap color drawable dynamic gradle icons imageview jitpack
Last synced: 3 months ago
JSON representation
Android Library to dynamically change color of drawable.
- Host: GitHub
- URL: https://github.com/mathiazhagan01/DrawableColorChange
- Owner: mathiazhagan01
- License: apache-2.0
- Created: 2016-09-18T07:07:00.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-16T19:23:11.000Z (about 4 years ago)
- Last Synced: 2024-06-16T03:31:37.465Z (5 months ago)
- Topics: android-library, bitmap, color, drawable, dynamic, gradle, icons, imageview, jitpack
- Language: Java
- Homepage:
- Size: 237 KB
- Stars: 99
- Watchers: 3
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - DrawableColorChange - drawable颜色修改工具 (Color)
README
# DrawableColorChange
Android Library to dynamically change color of drawable.[![](https://jitpack.io/v/mathiazhagan01/DrawableColorChange.svg)](https://jitpack.io/#mathiazhagan01/DrawableColorChange)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-DrawableColorChange-blue.svg?style=flat-square)](http://android-arsenal.com/details/3/4353)
[![Codix](https://codix.io/gh/badge/mathiazhagan01/DrawableColorChange)](https://codix.io/gh/repo/mathiazhagan01/DrawableColorChange)If you like the library, please rate us on codix.io!
### Gradle
#### Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
``` gradle
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```#### Step 2. Add the dependency
``` gradle
dependencies {
compile 'com.github.mathiazhagan01:DrawableColorChange:1.4'
}
```### Maven
#### Step 1. Add the JitPack repository to your build file
``` xml
jitpack.io
https://jitpack.io
```
#### Step 2. Add the dependency
``` xml
com.github.mathiazhagan01
DrawableColorChange
1.4
```### Before changing color
![Screenshot](./before.png)
### After changing color
![Screenshot](./after.png)
### Example 1
``` java
DrawableColorChange drawableColorChange = new DrawableColorChange(this);
drawableColorChange.setDrawable(R.drawable.icon);
drawableColorChange.setColorResId(R.color.colorAccent);
Drawable drawable = drawableColorChange.getColorChangedDrawable();
ImageView imageView = (ImageView) findViewById(R.id.image);
imageView.setImageDrawable(drawable);
```
### Example 2
``` java
imageView.setImageDrawable(drawableColorChange.changeColorById(R.drawable.icon, R.color.colorAccent));
```### Example 3
``` java
drawableColorChange.setDrawable(R.drawable.icon);
drawableColorChange.setColorResId(R.color.colorAccent);
Bitmap bitmap = drawableColorChange.getColorChangedBitmap();
imageView.setImageBitmap(bitmap);
```
### LICENSEDrawableColorChange library for Android
Copyright (c) 2017 Mathiazhagan Dinesh (http://github.com/mathiazhagan01).Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.