From 8dad0dd9efef3e60158dfdd33c047b1f040f8e84 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Fri, 18 Feb 2022 16:59:09 -0700 Subject: [PATCH] Fix for long running step loop --- coloraide/__meta__.py | 2 +- coloraide/interpolate.py | 3 +-- docs/src/markdown/about/changelog.md | 5 +++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/coloraide/__meta__.py b/coloraide/__meta__.py index e5a7575ec..9de506ea7 100644 --- a/coloraide/__meta__.py +++ b/coloraide/__meta__.py @@ -192,5 +192,5 @@ def parse_version(ver: str) -> Version: return Version(major, minor, micro, release, pre, post, dev) -__version_info__ = Version(0, 9, 0, "final") +__version_info__ = Version(0, 10, 0, "final") __version__ = __version_info__._get_canonical() diff --git a/coloraide/interpolate.py b/coloraide/interpolate.py index d6bfd7cc6..1a5adb5ac 100644 --- a/coloraide/interpolate.py +++ b/coloraide/interpolate.py @@ -390,8 +390,7 @@ def color_steps( # If we currently have delta over our limit inject more stops. # If inserting between every color would push us over the max_steps, halt. - count = len(ret) - while m_delta > max_delta_e and (count * 2 - 1 <= max_steps): + while m_delta > max_delta_e and (len(ret) * 2 - 1 <= max_steps): # Inject stops while measuring again to see if it was sufficient m_delta = 0.0 i = 1 diff --git a/docs/src/markdown/about/changelog.md b/docs/src/markdown/about/changelog.md index cb68f03ab..a0f44d4c2 100644 --- a/docs/src/markdown/about/changelog.md +++ b/docs/src/markdown/about/changelog.md @@ -1,5 +1,10 @@ # Changelog +## 0.10.0 + +- **FIX**: Fix an issue where when attempting to generate steps some ∆E distance apart, the maximum step range was not + respected and could result in large hangs. + ## 0.9.0 !!! warning "Breaking Change"