diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ce43330..71fe7947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [1.5.1] - 2021-07-09 + +This release contains two bugfixes: + +- Pinned minimum attrs version to usage of `kw_only` which was introduced in 18.2.0. See https://github.com/Beefy-Swain/pytiled_parser/pull/39 +- Fixed color parsing to be correct. Tiled saves it's colors in either RGB or ARGB format. We were previously parsing RGB correctly, but if an alpha value was present it would be parsed if it were RGBA and so all the values would be offset by one. + ## [1.5.0] - 2021-05-16 This release contains several new features. As of this release pytiled-parser supports 100% of Tiled's feature-set as of Tiled 1.6. diff --git a/pytiled_parser/util.py b/pytiled_parser/util.py index 8db180a5..75c7d1db 100644 --- a/pytiled_parser/util.py +++ b/pytiled_parser/util.py @@ -20,10 +20,10 @@ def parse_color(color: str) -> Color: return Color(int(color[0:2], 16), int(color[2:4], 16), int(color[4:6], 16), 255) elif len(color) == 8: return Color( - int(color[0:2], 16), int(color[2:4], 16), int(color[4:6], 16), int(color[6:8], 16), + int(color[0:2], 16), ) raise ValueError("Improperly formatted color passed to parse_color") diff --git a/pytiled_parser/version.py b/pytiled_parser/version.py index b16a143e..68061947 100644 --- a/pytiled_parser/version.py +++ b/pytiled_parser/version.py @@ -1,3 +1,3 @@ """pytiled_parser version""" -__version__ = "1.5.0" +__version__ = "1.5.1" diff --git a/setup.cfg b/setup.cfg index 3657362e..86ce2325 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,7 @@ setup_requires = setuptools >= 40.6 pip >= 10 install_requires = - attrs + attrs >= 18.2.0 typing-extensions [options.packages.find] diff --git a/tests/test_data/map_tests/external_tileset_dif_dir/expected.py b/tests/test_data/map_tests/external_tileset_dif_dir/expected.py index 1e866299..61687dfa 100644 --- a/tests/test_data/map_tests/external_tileset_dif_dir/expected.py +++ b/tests/test_data/map_tests/external_tileset_dif_dir/expected.py @@ -173,7 +173,7 @@ }, properties={ "bool property - true": True, - "color property": common_types.Color(255, 73, 252, 255), + "color property": common_types.Color(73, 252, 255, 255), "file property": Path("../../../../../../var/log/syslog"), "float property": 1.23456789, "int property": 13, diff --git a/tests/test_data/map_tests/no_layers/expected.py b/tests/test_data/map_tests/no_layers/expected.py index 7bc5ca2d..ab8b5ca0 100644 --- a/tests/test_data/map_tests/no_layers/expected.py +++ b/tests/test_data/map_tests/no_layers/expected.py @@ -35,7 +35,7 @@ }, properties={ "bool property - true": True, - "color property": common_types.Color(255, 73, 252, 255), + "color property": common_types.Color(73, 252, 255, 255), "file property": Path("../../../../../../var/log/syslog"), "float property": 1.23456789, "int property": 13, diff --git a/tests/test_data/map_tests/template/expected.py b/tests/test_data/map_tests/template/expected.py index ae8f84a5..5cab7fcb 100644 --- a/tests/test_data/map_tests/template/expected.py +++ b/tests/test_data/map_tests/template/expected.py @@ -68,7 +68,7 @@ }, properties={ "bool property - true": True, - "color property": common_types.Color(255, 73, 252, 255), + "color property": common_types.Color(73, 252, 255, 255), "file property": Path("../../../../../../var/log/syslog"), "float property": 1.23456789, "int property": 13, diff --git a/tests/test_data/tilesets/image_properties/expected.py b/tests/test_data/tilesets/image_properties/expected.py index d756b2b3..f83a9fb8 100644 --- a/tests/test_data/tilesets/image_properties/expected.py +++ b/tests/test_data/tilesets/image_properties/expected.py @@ -18,7 +18,7 @@ version="1.6", properties={ "bool property": True, - "color property": Color(255, 0, 0, 255), + "color property": Color(0, 0, 255, 255), "float property": 5.6, "int property": 5, "string property": "testing", diff --git a/tests/test_tiled_object.py b/tests/test_tiled_object.py index f202029d..10e71c4a 100644 --- a/tests/test_tiled_object.py +++ b/tests/test_tiled_object.py @@ -261,7 +261,7 @@ coordinates=common_types.OrderedPair(39.0678640445606, 131.826759122428), properties={ "bool property": False, - "color property": common_types.Color(255, 170, 0, 0), + "color property": common_types.Color(170, 0, 0, 255), "file property": Path("../../../../../../dev/null"), "float property": 42.1, "int property": 8675309,