Skip to content

Commit

Permalink
[fix] Pass on colorspace argument (#41)
Browse files Browse the repository at this point in the history
* Fix colorspace-argument to CLI not being passed on

* Bump version

* Update changelog
  • Loading branch information
qTipTip authored Oct 4, 2024
1 parent a3d48f9 commit 33f080b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

# Released

## [3.0.2] 04/10/2024

### Fixed

- Fixed a bug where the CLI did not respect the `--colorspace` argument when extracting colors.
## [3.0.1] 07/07/2024

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions Pylette/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():
parser.add_argument(
"--colorspace",
help="color space to represent colors in",
default="RGB",
default="rgb",
type=str,
choices=["rgb", "hsv", "hls"],
)
Expand All @@ -59,7 +59,7 @@ def main():
image = args.image_url

palette = extract_colors(image=image, palette_size=args.n, sort_mode=args.sort_by)
palette.to_csv(filename=args.out_filename, frequency=True, stdout=args.stdout)
palette.to_csv(filename=args.out_filename, frequency=True, stdout=args.stdout, colorspace=args.colorspace)
if args.display_colors:
palette.display()

Expand Down
1 change: 0 additions & 1 deletion Pylette/src/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def get_colors(self, colorspace: Literal["rgb", "hsv", "hls"] = "rgb") -> tuple[
tuple[int, ...] | tuple[float, ...]: The color values in the specified color space.
"""
colors = {"rgb": self.rgb, "hsv": self.hsv, "hls": self.hls}

return colors[colorspace]

@property
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pylette"
version = "3.0.1"
version = "3.0.2"
description = "A Python library for extracting color palettes from images."
authors = ["Ivar Stangeby"]
license = "MIT"
Expand Down Expand Up @@ -46,5 +46,6 @@ build-backend = "poetry.core.masonry.api"




[tool.poetry.scripts]
pylette = "Pylette.cmd:main"

0 comments on commit 33f080b

Please sign in to comment.