Skip to content

Commit 2dee7bc

Browse files
committed
Update coloraide 2.0.2
1 parent 09f7a3b commit 2dee7bc

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

lib/coloraide/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,5 @@ def parse_version(ver: str) -> Version:
192192
return Version(major, minor, micro, release, pre, post, dev)
193193

194194

195-
__version_info__ = Version(2, 0, 1, "final")
195+
__version_info__ = Version(2, 0, 2, "final")
196196
__version__ = __version_info__._get_canonical()

lib/coloraide/harmonies.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .spaces import Cylindrical
55
from .cat import WHITES
66
from . import util
7-
from typing import TYPE_CHECKING, Optional, List, Any # noqa: F401
7+
from typing import TYPE_CHECKING, Optional, List, Dict, Any # noqa: F401
88

99
if TYPE_CHECKING: # pragma: no cover
1010
from .color import Color
@@ -92,23 +92,23 @@ def harmonize(self, color: 'Color', space: Optional[str]) -> List['Color']:
9292
if steps_b <= 1:
9393
left = []
9494
if steps_b == 1:
95-
left.extend(color.steps([b, color], steps=steps_b, **kwargs))
95+
left.extend(color1.steps([b, color1], steps=steps_b, **kwargs))
9696
steps = min(self.RANGE - (1 + steps_b), steps_w)
97-
right = color.steps([color1, w], steps=steps, **kwargs)[rtrim]
97+
right = color1.steps([color1, w], steps=steps, **kwargs)[rtrim]
9898

9999
# Very close to white or is white, no need to interpolate from current color to white
100100
elif steps_w <= 1:
101101
right = []
102102
if steps_w == 1:
103-
right.extend(color.steps([color1, w], steps=steps_w, **kwargs))
103+
right.extend(color1.steps([color1, w], steps=steps_w, **kwargs))
104104
steps = min(self.RANGE - (1 + steps_w), steps_b)
105-
right.insert(0, color.clone())
106-
left = color.steps([b, color], steps=steps, **kwargs)[ltrim]
105+
right.insert(0, color1.clone())
106+
left = color1.steps([b, color1], steps=steps, **kwargs)[ltrim]
107107

108108
# Anything else in between
109109
else:
110-
left = color.steps([b, color], steps=steps_b, **kwargs)[ltrim]
111-
right = color.steps([color1, w], steps=steps_w, **kwargs)[rtrim]
110+
left = color1.steps([b, color1], steps=steps_b, **kwargs)[ltrim]
111+
right = color1.steps([color1, w], steps=steps_w, **kwargs)[rtrim]
112112

113113
# Extract a subset of the results
114114
len_l = len(left)

lib/coloraide/spaces/hwb/__init__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""HWB class."""
22
from ...spaces import Space, Cylindrical
33
from ...cat import WHITES
4+
from ... import util
45
from ...channels import Channel, FLG_ANGLE, FLG_OPT_PERCENT
56
from ...types import Vector
67

@@ -11,25 +12,20 @@ def hwb_to_hsv(hwb: Vector) -> Vector:
1112
h, w, b = hwb
1213

1314
wb = w + b
14-
if 1 - wb < 2e-07:
15-
gray = w / wb
16-
return [0.0, 0.0, gray]
15+
if wb >= 1:
16+
return [h, 0.0, w / wb]
1717

1818
v = 1 - b
1919
s = 0 if v == 0 else 1 - w / v
2020

21-
return [h, s, v]
21+
return [util.constrain_hue(h), s, v]
2222

2323

2424
def hsv_to_hwb(hsv: Vector) -> Vector:
2525
"""HSV to HWB."""
2626

2727
h, s, v = hsv
28-
w = v * (1 - s)
29-
b = 1 - v
30-
if 1 - (w + b) < 2e-07:
31-
h = 0.0
32-
return [h, w, b]
28+
return [util.constrain_hue(h), v * (1 - s), 1 - v]
3329

3430

3531
class HWB(Cylindrical, Space):
@@ -54,7 +50,7 @@ class HWB(Cylindrical, Space):
5450
def is_achromatic(self, coords: Vector) -> bool:
5551
"""Check if color is achromatic."""
5652

57-
if 1 - (coords[1] + coords[2]) < 2e-07:
53+
if (coords[1] + coords[2]) >= (1 - 1e-07):
5854
return True
5955

6056
v = 1 - coords[2]

0 commit comments

Comments
 (0)