Hex Color Plus
A Flutter plugin to convert hex string values into Color objects—supporting both standard 6-digit hex codes (#RRGGBB) and extended 8-digit hex codes with alpha transparency (#AARRGGBB).
🎨 Whether you're working with basic hex like
#FFFFFFor want fine control with#80FFAA33,HexColorPlusmakes it simple and flexible.
✨ Features
- Convert hex string (
#RRGGBB) toColor✔️ - Support 8-digit ARGB hex (
#AARRGGBB) for alpha channel ✔️ - Graceful fallback in case of invalid hex input ✔️
- Works seamlessly with Flutter's
Colorclass ✔️
🔧 Installation
Add this to your pubspec.yaml:
dependencies:
hex_color_plus: ^1.0.0
🚀 Usage
Import and use in your Dart code:
import 'package:hex_color_plus/hex_color_plus.dart';
void main() {
// Convert standard 6-digit hex (RRGGBB)
Color basic = HexColor.hexToColor("#FFAA88");
// Convert extended 8-digit hex with alpha (AARRGGBB)
Color withAlpha = HexColor.hexToColor("#88FFAA00");
print(basic);
print(withAlpha);
}
✅ Supported formats:
#RRGGBB → basic opaque colors
#AARRGGBB → colors with alpha transparency
📜 License
This plugin is licensed under the MIT License.