Install ColorArt via Gradle
masterAdd ColorArt as a dependency to your build.gradle file to use it in your Android project. Note that ColorArt is supported on Android 2.1 and above.
compile 'org.michaelevans.colorart:library:0.0.3'repository·master·Indexed 21 days ago
https://github.com/michaelevans/colorartAn Android library for analyzing images to extract themed color palettes, including background, primary, secondary, and detail colors. Supports Android 2.1 and above and includes a FadingImageView component for applying themed backgrounds with fading edges.
Add ColorArt as a dependency to your build.gradle file to use it in your Android project. Note that ColorArt is supported on Android 2.1 and above.
compile 'org.michaelevans.colorart:library:0.0.3'To extract a color theme from an image, decode a Bitmap and pass it to the ColorArt constructor. You can then retrieve specific color roles from the resulting instance.
// get a bitmap and analyze it
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.album);
ColorArt colorArt = new ColorArt(bitmap);
// get the colors
colorArt.getBackgroundColor()
colorArt.getPrimaryColor()
colorArt.getSecondaryColor()
colorArt.getDetailColor()The FadingImageView component allows you to apply a background color with a fading edge.
Use setBackgroundColor(int color, FadingImageView.FadeSide side) to set the color and specify which side the fade occurs on. You can control the visibility of the fade effect using setFadeEnabled(boolean enabled).
// Set the fading edge on the left side with the analyzed background color
mFadingImageView.setBackgroundColor(colorArt.getBackgroundColor(), FadingImageView.FadeSide.LEFT);
// Enable or disable the fade effect
mImageView.setFadeEnabled(true);