diff --git a/CHANGELOG.md b/CHANGELOG.md index a4da721..d9019e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [2.0.0] - TBD +## [2.0.0] - 2021-07-28 ### Added * `.toHex8()` at [PR #17](https://github.com/TinyCommunity/tinycolor2/pull/17) diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/lib/src/tinycolor.dart b/lib/src/tinycolor.dart index 6ec590e..60b307e 100644 --- a/lib/src/tinycolor.dart +++ b/lib/src/tinycolor.dart @@ -79,19 +79,25 @@ class TinyColor { final color = Color.fromARGB( _color.alpha, math.max( - 0, math.min( - 255, _color.red - (255 * -(amount / 100)).round(), - ), + 0, + math.min( + 255, + _color.red - (255 * -(amount / 100)).round(), + ), ), math.max( - 0, math.min( - 255, _color.green - (255 * -(amount / 100)).round(), - ), + 0, + math.min( + 255, + _color.green - (255 * -(amount / 100)).round(), + ), ), math.max( - 0, math.min( - 255, _color.blue - (255 * -(amount / 100)).round(), - ), + 0, + math.min( + 255, + _color.blue - (255 * -(amount / 100)).round(), + ), ), ); return TinyColor(color); diff --git a/pubspec.yaml b/pubspec.yaml index eef5023..86e46e5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,8 +4,8 @@ version: 2.0.0 homepage: https://github.com/TinyCommunity/tinycolor2 environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.0" dependencies: flutter: diff --git a/test/tinycolor_test.dart b/test/tinycolor_test.dart index 093cebe..787345d 100644 --- a/test/tinycolor_test.dart +++ b/test/tinycolor_test.dart @@ -7,7 +7,7 @@ void main() { test( "setAlpha updates alpha value of color", () { - TinyColor color = TinyColor(Color(0xFFFFFFFF)); + final TinyColor color = TinyColor(const Color(0xFFFFFFFF)); color.setAlpha(0x00); expect(color.color.alpha, 0x00); }, @@ -16,10 +16,11 @@ void main() { test( "setOpacity updates opacity value of color", () { - TinyColor color = TinyColor(Color(0xFFFFFFFF).withOpacity(1.0)); + final TinyColor color = + TinyColor(const Color(0xFFFFFFFF).withOpacity(1.0)); color.setOpacity(0.5); - // underlying dart implementation converts the opacity value to an + // underlying dart implementation converts the opacity value to an // int, then back into a double. Thus some precision is loss. expect(color.color.opacity, moreOrLessEquals(0.5, epsilon: 1e-2)); },