FooStudio / tinycolor

Flutter Color manipulation and conversion
MIT License
45 stars 23 forks source link

Tint and Shade functions ignore the amount parameter #2

Open Johann13 opened 5 years ago

Johann13 commented 5 years ago

The functions to create a tint or shade for a color have a paramater amount.

Currenly this is the library code

TinyColor tint([int amount = 10]) {
  return this.mix(input: Color.fromRGBO(255, 255, 255, 1.0));
}

TinyColor shade([int amount = 10]) {
  return this.mix(input: Color.fromRGBO(0, 0, 0, 1.0));
}
skylerknight commented 5 years ago

I'm having the same issue. When using the shade function the result is always pure black. I hope this gets fixed soon. Cheers!

NicolasDionB commented 5 years ago

I found that too!! That's an easy fix I think!!

NicolasDionB commented 5 years ago

Easy workaround for tint, you can do: Color.alphaBlend(Colors.white.withOpacity(amount / 100), color); and for shade: Color.alphaBlend(Colors.black.withOpacity(amount / 100), color);. Works like a charm.