vaab / colour

Python color representations manipulation library (RGB, HSL, web, ...)
BSD 2-Clause "Simplified" License
319 stars 41 forks source link

color_scale uses by default the shorter path considering the hue cycle, long path as an option #50

Open vokimon opened 4 years ago

vokimon commented 4 years ago

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=True option, 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!

codecov[bot] commented 4 years ago

Codecov Report

Merging #50 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   99.13%   99.14%   +<.01%     
==========================================
  Files           1        1              
  Lines         232      233       +1     
==========================================
+ Hits          230      231       +1     
  Misses          2        2
Impacted Files Coverage Δ
colour.py 99.14% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 11f138e...b21980c. Read the comment docs.