color_scale uses by default the shorter path considering the hue cycle, long path as an option #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses issue #47 which was also addressed by PR #48: Given that hue is a circular magnitude, color transitions should be able to take the shorter path when it requires crossing the 1 to 0 hue loop.
Unlike PR #48 this implementation, has added enough tests cases to have full branch coverage. Also the implementation is simpler and improves original code performance (2x in my box). By providing a
longer=Trueoption, it also preserves a way to obtain the former longer hue path (rainbow like scales) that the former implementation produced just in some cases. Now the longer path can be generated for any starting and ending points, not just between a purpleish and a yellowish red.Hope it helps, regards!