A Flutter package for parsing and using string-based colors (hex, rgb, CSS names) directly in Flutter apps.
Pigment is a Flutter package that extends Dart's Color class to enable easy parsing and usage of string-based colors in Flutter applications. It solves the problem of manually converting hex codes, RGB values, or CSS color names into Flutter-compatible Color objects, streamlining UI development.
Flutter developers building mobile, web, or desktop applications who need a simple way to work with colors using string formats like hex, RGB, or CSS names.
Developers choose Pigment because it reduces boilerplate code for color handling, supports multiple color formats out of the box, and integrates seamlessly with Flutter's existing Color class, making it both powerful and easy to adopt.
A simple but useful package to play with colors in flutter
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables direct use of hex codes like '#01E19F' and RGB strings via Pigment.fromString(), reducing manual conversion boilerplate as shown in the example code.
Provides access to standard CSS color names like 'lightsalmon' through Pigment.fromCSSColor(), making it familiar for web developers transitioning to Flutter.
Extends Dart's Color class, so all native methods remain available, ensuring compatibility with existing Flutter widgets and themes.
Offers straightforward constructors like Pigment.fromString() and new Pigment(), with clear examples in the README for easy adoption.
Only handles hex, RGB, and CSS names; lacks support for other common models like HSL or CMYK, which may be needed for advanced color manipulation.
Parsing color strings at runtime each time can be less efficient than using pre-defined Color constants, potentially affecting performance in color-intensive UIs.
The README does not detail how invalid strings are handled, which could lead to runtime errors or crashes if input validation is not implemented separately.