Skip to content

Repository files navigation

AndroidColorExtractor

AndroidColorExtractor is a lightweight and easy-to-use Android library that helps you extract colors from bitmaps. You can quickly get the dominant color, vibrant swatch, muted swatch, and even a complete list of detected colors.

Features

  • 🔥 Get dominant, vibrant, and muted colors from any image
  • 🎨 Extract all available swatches as hex color strings
  • ⚡️ Works with a single method call
  • 🧠 Built on top of Android's Palette API
  • 💡 Useful for theming, backgrounds, gradients, and more

Installation

Add the JitPack repository in your settings.gradle file:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

Then add the dependency in your build.gradle (app module):

implementation 'com.github.aakashsakhalkar:AndroidColorExtractor:v1.0.0'

Usage

ColorPaletteX.extractColors(
    bitmap,
    true,   // getDominant
    true,   // getVibrant
    true,   // getMuted
    true,   // getAllSwatches
    result -> {
        Log.d("ColorPaletteX", "Dominant: " + result.dominantColor);
        Log.d("ColorPaletteX", "Vibrant: " + result.vibrantColor);
        Log.d("ColorPaletteX", "Muted: " + result.mutedColor);

        for (String hex : result.allColors) {
            Log.d("ColorPaletteX", "Swatch: " + hex);
        }
    }
);

Result Example

Dominant: #F86018  
Vibrant:  #F86018  
Muted:    #5050B0  
Swatch:   #202098  
Swatch:   #9090C8  
Swatch:   #181898  
...

License

This project is MIT licensed.

About

AndroidColorExtractor is a lightweight Android library that extracts dominant, vibrant, muted, and all prominent colors from a bitmap. Useful for dynamic theming, image analysis, and UI customization. Simple to use, highly customizable, and works offline with no extra dependencies.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages