ColorArt Android Library

repository·master·Indexed 21 days ago

https://github.com/michaelevans/colorart

An 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.

Tokens
468
Snippets
3
Records
3
Agent score
25%

What's inside ColorArt

  1. Analyze an image with ColorArt

    master

    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()
  2. Use FadingImageView for themed backgrounds

    master

    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);