-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
This is a great utility package with some useful missing features, but would be nice if it were refactored for use with Flutter natively.. It's still functional being Dart, but doesn't work too well with the built-in Color type. For one, the class name conflicts with the existing Color class, it uses num instead of double or int, and a few other bits that make it dated from 3 years ago. I suggest reworking it a bit and re-releasing with a different name so us Flutterers can get some life out of it.
I mostly needed it for darken and lighten, so I adapted a function so I can put it to use, even though it's a bit clumsy. Here's my adapter in case it's useful to someone:
import 'package:color/color.dart' as colorUtil;
Color colorDarken(Color color, double amount) {
colorUtil.RgbColor rgbNew = colorUtil.ColorFilter.darken(
colorUtil.RgbColor(color.red, color.green, color.blue).toCielabColor(), [amount]).toRgbColor();
return Color.fromARGB(255, rgbNew.r.toInt(), rgbNew.g.toInt(), rgbNew.b.toInt());
}
Color colorLighten(Color color, double amount) {
colorUtil.RgbColor rgbNew = colorUtil.ColorFilter.lighten(
colorUtil.RgbColor(color.red, color.green, color.blue).toCielabColor(), [amount]).toRgbColor();
return Color.fromARGB(255, rgbNew.r.toInt(), rgbNew.g.toInt(), rgbNew.b.toInt());
}
JulianBissekkou, jaumard, urusaich and JonasWanke
Metadata
Metadata
Assignees
Labels
No labels