Last updated:
0 purchases
flutter color utils
Introduction #
Color Utils is an useful package for play with colors.
Features #
Mix multiple colors
Match percentage of two colors
Generate color from hex string
Color cooker [ get a colour palette list using the base colours list for the target colour ]
Getting started #
Install dependencies
color_utils:
git:
url: https://github.com/shawon1fb/color_utils.git
copied to clipboard
Import dependencies
import 'package:color_utils/flutter_color_utils.dart';
copied to clipboard
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
copied to clipboard
2. HexColor String to Color #
Color red = const Color(0xFF890041);
Color redHexColor = HexColor('#890041');
print(red == redHexColor);///true
print(redHexColor == red);///true
copied to clipboard
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
copied to clipboard
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
copied to clipboard
Additional information #
Reference #
https://color.adobe.com/create/color-wheel
https://trycolors.com/
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.