color_name_picker 1.3.0
color_name_picker: ^1.3.0 copied to clipboard
A Flutter color picker library that returns color names with hex codes. Supports multiple picker types including Material, Block, Slide, and Adaptive pickers.
Color Name Picker 🎨 #
A comprehensive Flutter color picker library that returns color names with hex codes. Supports multiple picker types and provides human-readable color names.
Features #
- Multi Picker Types - Material Design picker and Adaptive picker with multiple tabs
- Color Name Extraction - Get human-readable color names using advanced detection
- Hex Code & ARGB Values - Extract technical color information
- Easy to Use - Simple API with flexible customization
- Opacity Support - Full transparency/opacity control
- Dialog & Bottom Sheet - Multiple display modes
- Custom Colors - Support for custom color swatches
Installation #
Add this to your pubspec.yaml:
dependencies:
color_name_picker: ^1.2.0
How to Use #
Basic Usage #
import 'package:color_name_picker/color_name_picker.dart';
final ColorResult? result = await ColorNamePicker.showColorPicker(
context: context,
initialColor: Colors.blue,
pickerType: PickerType.adaptivePicker,
);
if (result != null) {
print('Hex: ${result.hexCode}');
print('Name: ${result.colorName}');
print('ARGB: ${result.argbValue}');
}
Bottom Sheet Picker #
final ColorResult? result = await ColorNamePicker.showColorPickerBottomSheet(
context: context,
initialColor: Colors.red,
pickerType: PickerType.materialPicker,
sheetTitle: 'Choose your color',
);
Direct Conversion #
// Convert Color to ColorResult
ColorResult result = ColorNamePicker.colorToResult(Colors.blue);
// Convert hex string to ColorResult
ColorResult result = ColorNamePicker.hexToResult('#FF0000');
Picker Types #
PickerType.materialPicker // Simple Material Design color picker
PickerType.adaptivePicker // Advanced picker with multiple tabs (primary, accent, custom, wheel)
Advanced Usage #
final ColorResult? result = await ColorNamePicker.showColorPicker(
context: context,
initialColor: Colors.green,
pickerType: PickerType.adaptivePicker,
dialogTitle: 'Select Theme Color',
enableOpacity: true,
showColorCode: true,
showColorName: true,
showLabel: true,
customColors: [
Colors.red,
Colors.green,
Colors.blue,
Color(0xFF123456),
],
pickerAreaHeight: 200,
);
Parameters #
| Parameter | Type | Default | Description |
|---|---|---|---|
| context | BuildContext | Required | Build context for showing dialog |
| initialColor | Color | Colors.blue | Initial selected color |
| pickerType | PickerType | adaptivePicker | Type of color picker |
| dialogTitle | String | 'Pick a color' | Title for dialog |
| sheetTitle | String | 'Pick a color' | Title for bottom sheet |
| enableOpacity | bool | true | Enable opacity/alpha channel |
| showColorCode | bool | true | Show hex color code |
| showColorName | bool | true | Show color name |
| showLabel | bool | true | Show labels in picker |
| pickerAreaHeight | double | 165 | Height of picker area |
| customColors | List | null | Custom color swatches |
About #
Bishal Maji
- GitHub: @bishalmaji
- Pub.dev: color_name_picker
Support This Project ❤️ #
If you find this package helpful and want to support its development, consider buying me a coffee!
☕ Support:
Buy Me a Coffee
Your contribution helps me maintain the project, add new features, and keep it updated.
Thank you for your support! 🙏