openframeworks / openframeworks/openFrameworks
bug in ofColor::setHsb() - unnecessary special cases for sat and brightness to zero
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
I wanted to use HSB for animating colors but with these exceptions in ofColor::setHsb this is harder than it should:
For example if you want to animate from blue to black and back to blue you normally only need to animate the brightness to 0 and back to 255. But with this implementation you will end up with white and not blue because of the two exceptions for saturation and brightness == 0.
Or in other words: Settings the brightness to zero doesn't mean black - it is just dark for the moment :)
I think it is the same for saturation. Turning the saturation to zero for a moment should not switch my color into grayscale.
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 in libs/openFrameworks/types/ofColor.cpp at the referenced ofColor::setHsb() exceptions around lines 469-472. Compare the current handling of zero saturation and brightness with the blue-to-black-to-blue and temporary-zero-saturation cases described in the issue. Done means the HSB animation behavior matches those expectations without the unnecessary special cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100