openframeworks / openframeworks/openFrameworks

bug in ofColor::setHsb() - unnecessary special cases for sat and brightness to zero

Open
#3,086 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug core documentation prelim-analysis section-internals
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.