Skip to content

Instantly share code, notes, and snippets.

@deepak786
Created December 22, 2015 21:26
Show Gist options
  • Save deepak786/e968e1dbf41dc1c389f5 to your computer and use it in GitHub Desktop.
Save deepak786/e968e1dbf41dc1c389f5 to your computer and use it in GitHub Desktop.
Palette (Library to get colour filters from Image Bitmap)
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