Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating for use with Flutter #18

Open
Skquark opened this issue Jul 14, 2018 · 1 comment
Open

Updating for use with Flutter #18

Skquark opened this issue Jul 14, 2018 · 1 comment
Assignees

Comments

@Skquark
Copy link

Skquark commented Jul 14, 2018

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());
}
@SergeShkurko
Copy link

You can usage another package maked specialy for flutter

(Inspired by it package)

@MichaelFenwick MichaelFenwick self-assigned this Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants