From 9301e91d9badcc029702c105e0e690fe9157d478 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sun, 25 Aug 2024 13:51:12 -0600 Subject: [PATCH] Rename MINDE class attribute from LIMIT to JND for consistency --- coloraide/gamut/fit_hct_chroma.py | 2 +- coloraide/gamut/fit_lch_chroma.py | 2 +- coloraide/gamut/fit_minde_chroma.py | 4 ++-- docs/src/markdown/about/changelog.md | 16 +++++++++------- docs/src/markdown/gamut.md | 12 ++++++------ 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/coloraide/gamut/fit_hct_chroma.py b/coloraide/gamut/fit_hct_chroma.py index 665f0976..8584e323 100644 --- a/coloraide/gamut/fit_hct_chroma.py +++ b/coloraide/gamut/fit_hct_chroma.py @@ -7,6 +7,6 @@ class HCTChroma(MINDEChroma): """HCT chroma gamut mapping class.""" NAME = "hct-chroma" - LIMIT = 2.0 + JND = 2.0 DE_OPTIONS = {"method": "hct"} PSPACE = "hct" diff --git a/coloraide/gamut/fit_lch_chroma.py b/coloraide/gamut/fit_lch_chroma.py index eab30aee..260c58c1 100644 --- a/coloraide/gamut/fit_lch_chroma.py +++ b/coloraide/gamut/fit_lch_chroma.py @@ -7,6 +7,6 @@ class LChChroma(MINDEChroma): """LCh chroma gamut mapping class.""" NAME = "lch-chroma" - LIMIT = 2.0 + JND = 2.0 DE_OPTIONS = {'method': '2000', 'space': 'lab-d65'} PSPACE = "lch-d65" diff --git a/coloraide/gamut/fit_minde_chroma.py b/coloraide/gamut/fit_minde_chroma.py index 62476078..d87db5e0 100644 --- a/coloraide/gamut/fit_minde_chroma.py +++ b/coloraide/gamut/fit_minde_chroma.py @@ -41,7 +41,7 @@ class MINDEChroma(Fit): """ NAME = "minde-chroma" - LIMIT = 0.02 + JND = 0.02 DE_OPTIONS = {"method": "ok"} # type: dict[str, Any] PSPACE = "oklch" MIN_CONVERGENCE = 0.0001 @@ -73,7 +73,7 @@ def fit( lightness = mapcolor[l] sdr = gamutcolor._space.DYNAMIC_RANGE == 'sdr' if jnd is None: - jnd = self.LIMIT + jnd = self.JND epsilon = calc_epsilon(jnd) if de_options is None: diff --git a/docs/src/markdown/about/changelog.md b/docs/src/markdown/about/changelog.md index 1c2c145c..c49a5537 100644 --- a/docs/src/markdown/about/changelog.md +++ b/docs/src/markdown/about/changelog.md @@ -6,20 +6,22 @@ - **NEW**: Define HTML output representation for Jupyter via `_repr_html_`. - **NEW**: Remove deprecated `model` parameter from `cam16` ∆E method. Space should be used instead. - **NEW**: Remove deprecated `algebra.npow` function. `algebra.spow` should be used instead. -- **NEW**: New generic `minde-chroma` gamut mapping method that allows specifying any perceptual space to operate in. - `oklch-chroma`, `lch-chroma`, and `hct-chroma` are now derived from `minde-chroma` and just default to using the +- **NEW**: New generic `minde-chroma` gamut mapping method that allows specifying any Lab-ish or LCh-ish to operate + in. `oklch-chroma`, `lch-chroma`, and `hct-chroma` are now derived from `minde-chroma` and just default to using the specified color space to provide backwards compatibility. `minde-chroma` defaults to using OkLCh by default. - **NEW**: All MINDE chroma reduction methods now skip distance checks if a JND of zero is specified. A JND of zero essentially disables the MINDE behavior and will reduce chroma as close to the gamut boundary as possible faster than it would previously. +- **NEW**: MINDE chroma reduction plugins now dynamically figures out lightness range instead of requiring it to be + specified as a class attribute. - **NEW**: MINDE chroma reduction gamut mapping and ray trace gamut mapping now allow for specifying an `adaptive` option which will bias the chroma reduction by the specified factor in a hue independent way relative to a midpoint of L = 50%. -- **NEW**: MINDE chroma reduction plugins now dynamically figure out lightness range instead of requiring it to be - specified as a class attribute. -- **BREAK**: MINDE chroma reductions combines the `DE` class attribute and the `DE_OPTIONS` under `DE_OPTIONS`. - specified. Users who have a derived gamut mapping class, these must now be combined under `DE_OPTIONS`. -- **BREAK**: MINDE chroma reduction plugins specify the perceptual space via the `PSPACE` attribute instead of `SPACE`. +- **BREAK**: MINDE chroma reductions plugin combines the `DE` and `DE_OPTIONS` class attributes under `DE_OPTIONS`. + Users who have a derived gamut mapping class must combined these two options under `DE_OPTIONS`. +- **BREAK**: MINDE chroma reduction plugin now specifies the perceptual space via the `PSPACE` attribute instead of + `SPACE`. Users who have a derived, personal gamut mapping plugin need to update the name accordingly. +- **BREAK**: MINDE chroma reduction plugins now specify the JND under the `JND` class attribute instead of `LIMIT`. Users who have a derived, personal gamut mapping plugin need to update the name accordingly. - **BREAK**: Finalize the `raytrace` gamut mapping algorithm implementation and remove experimental label. diff --git a/docs/src/markdown/gamut.md b/docs/src/markdown/gamut.md index 24282778..a3989686 100644 --- a/docs/src/markdown/gamut.md +++ b/docs/src/markdown/gamut.md @@ -450,11 +450,11 @@ Please see [Ray Tracing Chroma Reduction in Any Perceptual Space](#ray-tracing-c to learn how to use different perceptual spaces and how to set your own default. /// -ColorAide has developed an experimental chroma reduction technique that employs ray tracing. Its aim is to provide -faster chrome reduction for gamut mapping using constant lightness. This approach specifically targets RGB gamuts, or -spaces that can be represented with RGB gamuts. Additionally, if ColorAide can detect a linear version of the targeted -RGB gamut, that version will be used automatically for best results. Currently ColorAide can gamut map all officially -supported color spaces as they either have an RGB gamut or can be coerced into one. +ColorAide has developed a chroma reduction technique that employs ray tracing. Its aim is to provide faster chrome +reduction for gamut mapping using constant lightness. This approach specifically targets RGB gamuts, or spaces that can +be represented with RGB gamuts. Additionally, if ColorAide can detect a linear version of the targeted RGB gamut, that +version will be used automatically for best results. Currently ColorAide can gamut map all officially supported color +spaces as they either have an RGB gamut or can be coerced into one. The ray trace approach works by taking a given color and converting it to a perceptual Lab-ish or LCh-ish color space (the default being OkLCh) and then calculates the achromatic version of the color (chroma set to zero). Assuming the @@ -652,7 +652,7 @@ class HCTChroma(MINDEChroma): """HCT chroma gamut mapping class.""" NAME = "hct-chroma" - LIMIT = 2.0 + JND = 2.0 DE_OPTIONS = {"method": "hct"} PSPACE = "hct"