π¨ Color Extractor πΌοΈ
Hey there, color enthusiasts! π Welcome to the Camy Color Extractor project. This nifty little package helps you extract dominant colors from images in your Flutter apps. Whether you're building a cool photo app or just want to add some color magic to your UI, we've got you covered! π
π Features
- Extract dominant colors from various image formats (JPEG, PNG, GIF, BMP)
- Support for different color spaces (RGB, YUV420, NV21, BGRA8888)
- Efficient native implementation for Android and iOS
- Easy-to-use Dart API
- Isolate support for background processing
πΌοΈ Screenshots
π οΈ Installation
Add this to your package's pubspec.yaml file:
dependencies:
color_extractor: ^0.0.1
Then run:
flutter pub get
π Getting Started
First, initialize the ColorExtractor:
import 'package:color_extractor/color_extractor.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await ColorExtractor.initialize();
runApp(MyApp());
}
Now you're ready to extract some colors! π
πΈ Usage
Here's a quick example of how to extract dominant colors from an image:
import 'package:color_extractor/color_extractor.dart';
// Load an image (you can use AssetImage, NetworkImage, or MemoryImage)
final imageSource = await AssetImageAdapter.load('assets/my_cool_image.jpg');
// Extract dominant colors
final colors = await ColorExtractor.instance.getDominantColors(
image: imageSource,
numColors: 5, // Get the top 5 dominant colors
);
// Use the colors in your UI
colors.forEach((color) {
print('Dominant color: ${color.toString()}');
});
π§ How It Works
The Camy Color Extractor uses a clever combination of Dart and native code to efficiently extract dominant colors:
- Images are loaded and converted to a common format (RGB)
- The heavy lifting of color extraction is done in native code (C with FFI)
- Processing is done in an isolate to keep your UI buttery smooth π§
- Results are returned as a list of Flutter
Colorobjects
π£οΈ Roadmap
We've got big plans for Camy Color Extractor! Here's what's cooking:
xAndroid supportxiOS supportmacOS supportWindows supportWeb support (using WebAssembly)More color extraction algorithmsColor palette generation
π€ Contributing
We'd love your help to make Camy Color Extractor even more awesome! Feel free to:
- π Report bugs
- π‘ Suggest new features
- π§ Submit pull requests
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgements
A big shoutout to all the open-source projects that inspired us and the amazing Flutter community! You rock! πΈ
That's it, folks! Happy color extracting! If you create something cool with this package, we'd love to see it. Tag us on social media or send us a postcard (just kidding, but that would be pretty neat). π
Remember, in the world of color extraction, every pixel counts! π