Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[color-gamut] Changing Chroma increments parameter in the Demo hangs the page #15

Closed
DmitrySharabin opened this issue May 6, 2024 · 1 comment

Comments

@DmitrySharabin
Copy link
Collaborator

In all browsers.

The Demo

@LeaVerou LeaVerou changed the title Changing Chroma increments parameter in the Demo of <color-gamut> hangs the page [color-gamut] Changing Chroma increments parameter in the Demo hangs the page May 7, 2024
@DmitrySharabin
Copy link
Collaborator Author

This happens because of an infinite loop we might get when Chroma increments becomes equal to 0. This means that step (L58) becomes equal to 0. And the following loop (L66-68) becomes infinite:

for (let c = c_range.min; c<= c_range.max; c+=step) {
	colors.push(`oklch(${l.value}% ${c.toLocaleString("en")}% ${h.value})`);
}

The fix is rather simple (L52):

- <input type=number id=c_step value="0.2" min="0">
+ <input type=number id=c_step value="0.2" min="0.1" step="0.1">

We might want to adjust step, but min should never be equal to 0.

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

No branches or pull requests

1 participant