flutter_color_utils 0.0.1 copy "flutter_color_utils: ^0.0.1" to clipboard
flutter_color_utils: ^0.0.1 copied to clipboard

Color Utils is an useful package for play with colors.

Introduction #

Color Utils is an useful package for play with colors.

Features #

  1. Mix multiple colors
  2. Match percentage of two colors
  3. Generate color from hex string
  4. Color cooker [ get a colour palette list using the base colours list for the target colour ]

Getting started #

  1. Install dependencies
color_utils:
    git:
      url: https://github.com/shawon1fb/color_utils.git
  1. Import dependencies
    import 'package:color_utils/flutter_color_utils.dart';

Usage #

Useful examples for color_utils users. more examples to /test folder.

1. Multi colors mixer #


Color red = const Color(0xFF890041);
Color yellow = const Color(0xffFFCE51);
Color blue = const Color(0xff00224C);

List<Color> spicyMixerList = [yellow, red, blue];
Color mix = ColorUtils.mixColors(spicyMixerList);

Color spicyMixColor = const Color(0xff83504A);

print(spicyMixColor == mix );/// true

2. HexColor String to Color #


Color red = const Color(0xFF890041);
Color redHexColor = HexColor('#890041');
print(red == redHexColor);///true

print(redHexColor == red);///true

3. Match percentage of two colors #


Color spicyMixColor = const Color(0xff83504A);
Color pelorousColor = const Color(0xff44AABB);

double match = spicyMixColor.match(pelorousColor);
double expected = 64.31;
print(((match - expected) <0.02));///true

4. Color cooker #

 Color spicyMixColor = const Color(0xff83504A);
 List<Color> baseColorList = [
   const Color(0xFF890041),
   const Color(0xffFFCE51),
   const Color(0xff00224C),
   const Color(0xffFFFFFF),
   const Color(0xff21211A),
    ];
 ColorRecipe colorReversed =
        ColorRecipe(baseColorsList: baseColorList, targetColor: spicyMixColor);
 colorReversed.getColorRecipe(<Color>[]);
 print(colorReversed.bestList);
 print(colorReversed.globalMaxMatch==100.0); /// true

Additional information #

Reference #

  1. https://color.adobe.com/create/color-wheel
  2. https://trycolors.com/
3
likes
120
points
138
downloads

Publisher

unverified uploader

Weekly Downloads

Color Utils is an useful package for play with colors.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_color_utils