Skip to content

Commit 4bfa875

Browse files
committed
Upgrade ColorAide to 6.0.0 and require Python 3.13 for upcoming ST
1 parent 5d6870c commit 4bfa875

24 files changed

+183
-127
lines changed

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8
1+
3.13

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ColorHelper
22

3+
## 6.5.0
4+
5+
- **NEW**: Upgrade ColorAide to 6.0.0.
6+
- **NEW**: Require Python 3.13 for Sublim Text 4201+.
7+
38
## 6.4.5
49

510
- **FIX**: Fix SCSS support.

dependencies.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"*": {
33
">=3124": [
4-
"mdpopups",
5-
"typing"
4+
"mdpopups"
65
]
76
}
87
}

lib/coloraide/__meta__.py

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

195195

196-
__version_info__ = Version(5, 1, 0, "final")
196+
__version_info__ = Version(6, 0, 0, "final")
197197
__version__ = __version_info__._get_canonical()

lib/coloraide/algebra.py

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3469,34 +3469,6 @@ def reshape(array: ArrayLike | float, new_shape: int | Shape) -> float | Array:
34693469
return m
34703470

34713471

3472-
def _shape(a: ArrayLike | float, s: Shape) -> Shape:
3473-
"""
3474-
Get the shape of the array.
3475-
3476-
We only test the first index at each depth for speed.
3477-
"""
3478-
3479-
# Found a scalar input
3480-
if not isinstance(a, Sequence):
3481-
return s
3482-
3483-
# Get the length
3484-
size = len(a)
3485-
3486-
# Array is empty, return the shape
3487-
if not size:
3488-
return (size,)
3489-
3490-
# Recursively get the shape of the first entry and compare against the others
3491-
first = _shape(a[0], s)
3492-
for r in range(1, size):
3493-
if _shape(a[r], s) != first:
3494-
raise ValueError('Ragged lists are not supported')
3495-
3496-
# Construct the final shape
3497-
return (size,) + first
3498-
3499-
35003472
@overload
35013473
def _quick_shape(a: float) -> EmptyShape:
35023474
...
@@ -3519,7 +3491,7 @@ def _quick_shape(a: TensorLike) -> TensorShape:
35193491

35203492
def _quick_shape(a: ArrayLike | float) -> Shape:
35213493
"""
3522-
Acquire shape taking shortcuts by assume a non-ragged, consistently shaped array.
3494+
Acquire shape taking shortcuts by assuming a non-ragged, consistently shaped array.
35233495
35243496
No checking for consistency is performed allowing for a quicker check.
35253497
"""
@@ -3558,7 +3530,25 @@ def shape(a: TensorLike) -> TensorShape:
35583530
def shape(a: ArrayLike | float) -> Shape:
35593531
"""Get the shape of a list."""
35603532

3561-
return _shape(a, ())
3533+
# Found a scalar input
3534+
if not isinstance(a, Sequence):
3535+
return ()
3536+
3537+
# Get the length
3538+
size = len(a)
3539+
3540+
# Array is empty, return the shape
3541+
if not size:
3542+
return (size,)
3543+
3544+
# Recursively get the shape of the first entry and compare against the others
3545+
first = shape(a[0])
3546+
for r in range(1, size):
3547+
if shape(a[r]) != first:
3548+
raise ValueError('Ragged lists are not supported')
3549+
3550+
# Construct the final shape
3551+
return (size,) + first
35623552

35633553

35643554
def fill_diagonal(matrix: Matrix | Tensor, val: float | ArrayLike, wrap: bool = False) -> None:

lib/coloraide/cat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"A": (0.44758, 0.40745),
1919
"B": (0.34842, 0.35161),
2020
"C": (0.31006, 0.31616),
21-
"D50": (0.34570, 0.35850), # Use 4 digits like everyone
21+
"D50": (0.34570, 0.35850), # Use 4 digits like everyone (0.34567, 0,35851)
2222
"D55": (0.33243, 0.34744),
23-
"D65": (0.31270, 0.32900), # Use 4 digits like everyone
23+
"D65": (0.31270, 0.32900), # Use 4 digits like everyone (0.31272, 0,32903)
2424
"D75": (0.29903, 0.31488),
2525
"ACES-D60": (0.32168, 0.33767),
2626
"ASTM-E308-D65": cast('tuple[float, float]', tuple(util.xyz_to_xyY([0.95047, 1.0, 1.08883])[:-1])),

lib/coloraide/color.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
from .temperature.ohno_2013 import Ohno2013
8282
from .temperature.robertson_1968 import Robertson1968
8383
from .types import Plugin
84-
from typing import overload, Sequence, Iterable, Any, Callable, Mapping
84+
from typing import Iterator, overload, Sequence, Iterable, Any, Callable, Mapping
8585
if (3, 11) <= sys.version_info:
8686
from typing import Self
8787
else:
@@ -194,6 +194,11 @@ def __len__(self) -> int:
194194

195195
return len(self._space.channels)
196196

197+
def __iter__(self) -> Iterator[float]:
198+
"""Initialize iterator."""
199+
200+
return iter(self._coords)
201+
197202
@overload
198203
def __getitem__(self, i: str | int) -> float:
199204
...

lib/coloraide/distance/delta_e_cam02.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def distance(
3434

3535
# Normal approach to specifying CAM02 target space
3636
cs = color.CS_MAP[space]
37-
if not isinstance(color.CS_MAP[space], CAM02UCS):
37+
if not isinstance(cs, CAM02UCS):
3838
raise ValueError("Distance color space must be derived from CAM02UCS.")
39-
model = cs.MODEL # type: ignore[attr-defined]
39+
model = cs.MODEL
4040
kl = COEFFICENTS[model][0]
4141

4242
j1, a1, b1 = color.convert(space).coords(nans=False)

lib/coloraide/distance/delta_e_cam16.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def distance(
2727

2828
# Normal approach to specifying CAM16 target space
2929
cs = color.CS_MAP[space]
30-
if not isinstance(color.CS_MAP[space], CAM16UCS):
30+
if not isinstance(cs, CAM16UCS):
3131
raise ValueError("Distance color space must be derived from CAM16UCS.")
32-
model = cs.MODEL # type: ignore[attr-defined]
32+
model = cs.MODEL
3333
kl = COEFFICENTS[model][0]
3434

3535
j1, a1, b1 = color.convert(space).coords(nans=False)

lib/coloraide/everything.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from .spaces.hct import HCT
3636
from .spaces.ucs import UCS
3737
from .spaces.rec709 import Rec709
38+
from .spaces.rec709_oetf import Rec709OETF
3839
from .spaces.ryb import RYB, RYBBiased
3940
from .spaces.cubehelix import Cubehelix
4041
from .spaces.rec2020_oetf import Rec2020OETF
@@ -61,6 +62,7 @@ class ColorAll(Base):
6162
[
6263
# Spaces
6364
Rec709(),
65+
Rec709OETF(),
6466
DIN99o(),
6567
LCh99o(),
6668
Luv(),

0 commit comments

Comments
 (0)