Skip to content

[css-color-4] Gamut mapping pseudocode is confusing #10226

@nex3

Description

@nex3

The sample pseudocode for gamut mapping is confusing, particularly in step 18 (the "while" loop). There are cases where the pseudocode doesn't say whether the loop should continue looping, but it's not clear whether that means it should terminate or implicitly continue (since 18 says "repeat the following steps"). This is made more confusing by the fact that sometimes the pseudocode does explicitly say to continue.

For example, if at step 18.3 min_inGamut is false and inGamut(current) is true, neither condition in 18.3 nor 18.4 will match, and there's no explicit indication what should happen. I tried checking the Color.js implementation as a reference, but it seems that it runs step 4 incorrectly in this case. What is the correct behavior here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions