flutter_color 1.0.0 copy "flutter_color: ^1.0.0" to clipboard
flutter_color: ^1.0.0 copied to clipboard

outdated

Flutter plugin for works with colors schemes like a hex, hsl, xyz and cielab

flutter_color #

Flutter package widening a Color class which can be used to create, convert, compare colors and uses in UI. And also for working with editing color

// Usage hex from string and alternative color systems

HexColor('000000')                 // -> Color(0xFF000000)
HslColor(164, 100, 88)             // -> Color(0xFFC2FFEF)
XyzColor(0.1669, 0.2293, 0.0434)   // -> Color(0xFF659027)
CielabColor(36.80, 55.20, -95.61)  // -> Color(0xFF4832F7)

// Make color darker or lighter
Color(0xFF000000).lighter(100)     // -> Color(0xFFFFFFFF)
Color(0xFF000000).darker(50)       // -> Color(0xFF808080)

Getting Started #

In your flutter project add the dependency:

pub package

dependencies:
  flutter_color: any

For help getting started with Flutter, view the online documentation.

Examples #

// HexColor
assert(HexColor('000000')    == Color(0xFF000000));
assert(HexColor('#000000')   == Color(0xFF000000));
assert(HexColor('FFFFFFFF')  == Color(0xFFFFFFFF));
assert(HexColor('#B1000000') == Color(0xB1000000));
assert(HexColor('#B1000000').hexColor, '#B1000000');

// HslColor
assert(HslColor(164, 100, 88) == Color(0xFFC2FFEF));

// HyzColor
assert(XyzColor(0.1669, 0.2293, 0.0434) == Color(0xFF659027));

/// CielabColor
assert(CielabColor(36.80, 55.20, -95.61) == Color(0xFF4832F7));

Make color darker or lighter Usage dart extension methods

// [black -> white] lighter by 100 percents
assert(Color(0xFF000000).lighter(100), Color(0xFFFFFFFF));
// Another lighter example
assert(Color.fromARGB(255, 64, 64, 64).lighter(50),   Color.fromARGB(255, 192, 192, 192));

// [white -> grey] darker by 50 percents
assert(Color(0xFF000000).darker(50), Color(0xFF808080));
// Another darker example
assert(Color.fromARGB(255, 192, 192, 192).darker(25), Color.fromARGB(255, 128, 128, 128));

How it works? Easy :)

Inspired by #

Color dart package

24
likes
0
pub points
88%
popularity

Publisher

verified publisherserge.software

Flutter plugin for works with colors schemes like a hex, hsl, xyz and cielab

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_color