image_palette_extractor 0.0.1 copy "image_palette_extractor: ^0.0.1" to clipboard
image_palette_extractor: ^0.0.1 copied to clipboard

Flutter plugin to extract the dominant color or a color palette from an image. Perfect for dynamic interfaces such as Spotify.

🎨 image_palette_extractor #

A Flutter plugin for extracting the dominant color or a color palette from an image, ideal for dynamic UI effects similar to Spotify or Apple Music.


🚀 Installation #

Add to your pubspec.yaml:

dependencies:
  image_palette_extractor: ^0.0.1

📦 Required dependencies #

dependencies:
  image: ^4.0.17
  http: ^1.1.0

🧠 Features #

Method Description
extractDominantColorFromUrl Returns the most frequent color from an image
extractPaletteFromUrl Returns a list of dominant colors for gradients

✨ Example usage #

🎯 Dominant color #

final color = await extractDominantColorFromUrl('https://example.com/image.jpg');

if (color != null) {
  print('Dominant: ${color.red}, ${color.green}, ${color.blue}');
}

🎨 Color palette #

final palette = await extractPaletteFromUrl('https://example.com/image.jpg', count: 3);

for (final color in palette) {
  print('Color: ${color.value.toRadixString(16)}');
}

🖌️ Apply as gradient background #

Container(
  decoration: BoxDecoration(
    gradient: LinearGradient(
      colors: palette,
      begin: Alignment.topLeft,
      end: Alignment.bottomRight,
    ),
  ),
  child: const Text('Dynamic background'),
)

✅ Running tests #

flutter test

📁 Project structure #

lib/
├── image_palette_extractor.dart         // Main export file
└── src/
    ├── image_loader.dart                // Loads and decodes images
    └── palette_extractor.dart           // Color extraction logic
4
likes
150
points
30
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to extract the dominant color or a color palette from an image. Perfect for dynamic interfaces such as Spotify.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, image

More

Packages that depend on image_palette_extractor