Skip to content

Commit

Permalink
Address two divide by zero cases that were missed
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Mar 17, 2021
1 parent de79690 commit 0b4d125
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion coloraide/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,5 @@ def parse_version(ver):
return Version(major, minor, micro, release, pre, post, dev)


__version_info__ = Version(0, 1, 0, "alpha", 9)
__version_info__ = Version(0, 1, 0, "alpha", 10)
__version__ = __version_info__._get_canonical()
2 changes: 1 addition & 1 deletion coloraide/colors/hsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def srgb_to_hsl(rgb):
h = (b - r) / c + 2.0
else:
h = (r - g) / c + 4.0
s = c / (1.0 - abs(2.0 * l - 1))
s = 0 if l == 0 or l == 1 else c / (1.0 - abs(2.0 * l - 1))
h *= 60.0

return HSL._constrain_hue(h), s * 100.0, l * 100.0
Expand Down
5 changes: 5 additions & 0 deletions docs/src/markdown/about/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.10a10

- **FIX**: Address two divide by zero cases in HSL algorithm. Was missing some special cases when luminance equals `1`
or `0`.

## 0.1.0a9

- **FIX**: Ensure all cases of hue handling, in regards to gamut mapping, are done the same.
Expand Down

0 comments on commit 0b4d125

Please sign in to comment.