Skip to content

Fix plane steps, custom-space restoration and gamut hue wrapping - #368

Merged
smelfungus merged 6 commits into
masterfrom
pre-release-follow-ups
Sep 28, 2026
Merged

smelfungus merged 6 commits into
masterfrom
pre-release-follow-ups

Conversation

@smelfungus

Copy link
Copy Markdown
Member

Builds on #367.

Defects, each with a test that fails on dd4b25e:

  • Plane steps build on the step not yet answered. Screen-reader actions taken before the caller's update recomposed the plane each started from the old position, so a step on one axis undid the one just taken on the other. Steps also start from the drawn position, so a NaN value no longer stays NaN whatever key is pressed.
  • A controlled picker restores hue memory for a color in the app's own space. Its saver knew only the library's spaces and the picker's, so after recreation a grey came back at hue 0.
  • RgbGamut.maxChroma and cusp wrap the hue first, as ColorValue does. Double.MAX_VALUE answered NaN, and a hue such as 1e20 was taken as a different angle.
  • Equal RgbPrimaries hash alike when a coordinate is -0.0.

Docs:

  • CSS Color 4 §14.2 allows three gamut-mapping algorithms; Css is the binary search with local MINDE, which holds lightness and hue to within a just-noticeable difference, and ChromaReduction holds them to rounding. README and the GamutMapping KDoc say which is which.
  • The CMYK KDoc no longer calls the model reversible: many CMYK values give one RGB, and an RGB color whose highest channel is exactly 0 with another below it is singular.
  • README: a requirements section, the saveable state in the Quick Start, and the classpath clash between 1.x and 2.x. It no longer names 1.2.1 as the latest release, which Maven Central does not have, and no longer says CI checks the gallery images, which are copies of the screenshot references.

Also clears three compiler warnings.

Module JVM Android host wasm
color 242 229 229
color-compose 14 14 14
colorpicker-foundation 312 156 156
colorpicker-material3 173 4 4

apiCheck and the 30 screenshot baselines pass.

equals compares the coordinates with ==, which takes 0.0 and -0.0 as equal, but hashCode hashed their bits, so two equal primaries could miss each other as map keys. A primary on x = 0, as ACES AP0's green is, makes the sign reachable from ordinary arithmetic.
maxChroma and cusp multiplied the hue by pi before any reduction, so Double.MAX_VALUE overflowed to infinity and answered NaN, and a hue such as 1e20 was rounded to a different angle from the one a ColorValue of that hue stores. They now wrap it with the function ColorValue uses.
A controlled picker keeps an incoming value in the caller's space, but its saver knew only the library's spaces and the picker's own. A value in any other space did not restore, so the state was rebuilt after recreation and a grey came back at hue 0 rather than the hue it had been dragged from.
The plane stepped from the values of its last composition. Screen-reader actions taken before the caller's update recomposed it each started from the old position, so a step on one axis undid the step just taken on the other: right, up, right from the centre ended with x one step short. The plane now builds on the step it reported until composition answers, as BasicColorSlider does.

Steps also start from the position drawn rather than the raw value, which puts an out-of-range value at the edge and NaN at 0. A NaN x stayed NaN whatever key was pressed.
A redundant cast, a missing opt-in for runCurrent, and ThreadLocal.get()'s nullable platform type, which Kotlin 2.4 reports as a Java type mismatch. All three printed on every build.
CSS Color 4 section 14.2 now allows three gamut-mapping algorithms. The library's Css is the binary search with local MINDE, which returns a clipped color within a just-noticeable difference, so lightness and hue move by up to that; ChromaReduction is the one that keeps them to rounding. The CMYK KDoc called the model reversible, but many CMYK values give one RGB, and an RGB color whose highest channel is exactly 0 with another below it is singular.

README said the gallery images are the screenshot references CI checks, while they are copies it never compares; that HSV is a CSS formula, which CSS does not define; that planes are built off the main thread on the web, which has one thread; and that 1.2.1 is the latest release, which Maven Central does not have. It gains a requirements section, the saveable state in the Quick Start, and the classpath clash between 1.x and 2.x, which both ship codes.side.colorpicker.state.ColorPickerState.
@smelfungus
smelfungus merged commit 8c98c8c into master Sep 28, 2026
2 checks passed
@smelfungus
smelfungus deleted the pre-release-follow-ups branch September 28, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant