Skip to content

Commit ee3ab47

Browse files
authored
Merge pull request #5 from dsyrstad/master
Fixes issues #2, #6, and #10 on FooStudio/tinycolor
2 parents f61116c + 797606a commit ee3ab47

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

lib/tinycolor.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ class TinyColor {
110110
}
111111

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

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

120120
TinyColor desaturate([int amount = 10]) {
@@ -143,12 +143,12 @@ class TinyColor {
143143
}
144144

145145
TinyColor mix({@required Color input, int amount = 50}) {
146-
final int p = (amount / 100).round();
146+
final p = amount / 100.0;
147147
final color = Color.fromARGB(
148-
(input.alpha - _color.alpha) * p + _color.alpha,
149-
(input.red - _color.red) * p + _color.red,
150-
(input.green - _color.green) * p + _color.green,
151-
(input.blue - _color.blue) * p + _color.blue);
148+
((input.alpha - _color.alpha) * p + _color.alpha).round(),
149+
((input.red - _color.red) * p + _color.red).round(),
150+
((input.green - _color.green) * p + _color.green).round(),
151+
((input.blue - _color.blue) * p + _color.blue).round());
152152
return TinyColor(color);
153153
}
154154

0 commit comments

Comments
 (0)