Skip to content

Clamp color() to maxes #7715

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

Merged
merged 1 commit into from
Apr 9, 2025
Merged

Clamp color() to maxes #7715

merged 1 commit into from
Apr 9, 2025

Conversation

davepagurek
Copy link
Contributor

Found in processing/p5.js-website#780: color channels go beyond their maxes and look different than in 1.x.

This adds clamping, but only when created with color() (which includes colors passed to fill(), stroke(), background(), etc.) This is because WebGL mode internally creates a color with negative values to represent a null color in geometry that should be replaced with the active fill color.

Live: https://editor.p5js.org/davepagurek/sketches/xsXcVJSMO

@davepagurek davepagurek merged commit c8ab943 into dev-2.0 Apr 9, 2025
2 checks passed
@davepagurek davepagurek deleted the clamp-color branch April 9, 2025 23:13
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