tinycolor icon indicating copy to clipboard operation
tinycolor copied to clipboard

Tint and Shade functions ignore the amount parameter

Open Johann13 opened this issue 5 years ago • 3 comments

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));
}

Johann13 avatar Oct 03 '19 15:10 Johann13

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

skylerknight avatar Nov 15 '19 04:11 skylerknight

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

NicolasDionB avatar Nov 21 '19 12:11 NicolasDionB

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.

NicolasDionB avatar Nov 21 '19 12:11 NicolasDionB