Created
December 22, 2015 21:26
-
-
Save deepak786/e968e1dbf41dc1c389f5 to your computer and use it in GitHub Desktop.
Palette (Library to get colour filters from Image Bitmap)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Add library to gradle. | |
compile 'com.android.support:palette-v7:23.0.1' | |
2. Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() { | |
public void onGenerated(Palette p) { | |
// Use generated instance | |
p.getDarkMutedColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getDarkVibrantColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getLightMutedColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getLightVibrantColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getMutedColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getVibrantColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
} | |
}); | |
Documentation:- http://developer.android.com/reference/android/support/v7/graphics/Palette.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment