Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: tinycolor
description: Flutter Color manipulation and conversion, ported from JS tinycolor2
version: 1.0.3
version: 1.0.4
homepage: https://github.com/FooStudio/tinycolor

environment:
Expand Down