Should p5.strands support HSB-based color construction via an optional mode parameter in color()?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
Topic
Topic
During review of #8822, a follow-up idea came up around supporting HSB-based color construction in p5.strands without relying on colorMode().
One possible approach would be to allow an optional mode parameter in color():
color(v1, v2, v3, [alpha], [mode])
Example use case:
let h = (hue(mixed) + millis() * 0.001) % 360;
let s = saturation(mixed);
let br = brightness(mixed);
let hueShift = color(h, s, br, alpha(mixed), HSB);
Currently, p5.strands stores colors internally as normalized RGBA vec4 values and does not support colorMode(). This keeps behavior simple and predictable, but it also makes it harder to construct new colors from HSB values after extracting hue, saturation, and brightness information.
Questions worth discussing:
- Should p5.strands support HSB-based color construction?
- If so, should it be done through an optional mode parameter in
color()? - Should this functionality exist only inside strands, or should it also be available in regular p5.js for consistency?
- Are there alternative APIs that would be clearer or easier to maintain?
This is intended as a design discussion rather than a concrete implementation proposal.
Related PR: #8822
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with related PR #8822 and the current p5.strands color() behavior described here. Compare the proposed optional mode parameter with alternatives and decide whether HSB construction belongs in strands or regular p5.js; done means an agreed API direction and scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100