Skip to content

Commit

Permalink
Fixes issues TinyCommunity#2 and TinyCommunity#10 in FooStudio/tinycolor
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyrstad committed Jun 24, 2021
1 parent f61116c commit 797606a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/tinycolor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ class TinyColor {
}

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

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

TinyColor desaturate([int amount = 10]) {
Expand Down Expand Up @@ -143,12 +143,12 @@ class TinyColor {
}

TinyColor mix({@required Color input, int amount = 50}) {
final int p = (amount / 100).round();
final p = amount / 100.0;
final color = Color.fromARGB(
(input.alpha - _color.alpha) * p + _color.alpha,
(input.red - _color.red) * p + _color.red,
(input.green - _color.green) * p + _color.green,
(input.blue - _color.blue) * p + _color.blue);
((input.alpha - _color.alpha) * p + _color.alpha).round(),
((input.red - _color.red) * p + _color.red).round(),
((input.green - _color.green) * p + _color.green).round(),
((input.blue - _color.blue) * p + _color.blue).round());
return TinyColor(color);
}

Expand Down

0 comments on commit 797606a

Please sign in to comment.