Increasing access
A color module that behaves more consistently with more powerful feature unlocks additional opportunity to explore colors and create p5.js sketches that can exist in environment that uses a wider variety of color profiles.
Which types of changes would be made?
Most appropriate sub-area of p5.js?
What's the problem?
The current color system of p5.js has a few notable flaws:
- All colors are coerced into being 8-bit RGB values and there are no support of colors wider than the RGB color space
- Colors once created have the color mode of when they are created attached to them, ie. a color created when the sketch is in RGB color mode, will always be in RGB color mode even if the sketch's color mode is changes to HSB or something else.
- Only RGB, HSL, and HSB are supported
What's the solution?
A new color module will be implemented. The some of the requirements of this new color module are:
The recommended references/inspirations for how this new color module should work are CSS color specs and color.js. However it is not recommended to bundle color.js as their approach, while very comprehensive, is somewhat complex and for p5.js 2.0 we should aim for as few external dependencies as possible.
At the same time while relying on browser CSS implementation may help simplify many of the implementation, it may be worth considering the potential scenario of p5.js itself, or even just the color module being used as a standalone module, being used outside of the browser.
Pros (updated based on community comments)
- More intuitive and easy to use color API in p5.js
Cons (updated based on community comments)
- Likely to break at least some sketches
- There may be some API changes to how color object works as well
Proposal status
Under review
Increasing access
A color module that behaves more consistently with more powerful feature unlocks additional opportunity to explore colors and create p5.js sketches that can exist in environment that uses a wider variety of color profiles.
Which types of changes would be made?
Most appropriate sub-area of p5.js?
What's the problem?
The current color system of p5.js has a few notable flaws:
What's the solution?
A new color module will be implemented. The some of the requirements of this new color module are:
p5.Color,p5.Vectoretc.) to be used outside of the browser (node, deno, bun etc.)? #6830The recommended references/inspirations for how this new color module should work are CSS color specs and color.js. However it is not recommended to bundle color.js as their approach, while very comprehensive, is somewhat complex and for p5.js 2.0 we should aim for as few external dependencies as possible.
At the same time while relying on browser CSS implementation may help simplify many of the implementation, it may be worth considering the potential scenario of p5.js itself, or even just the color module being used as a standalone module, being used outside of the browser.
Pros (updated based on community comments)
Cons (updated based on community comments)
Proposal status
Under review