Fix clipping of rgb_from_vector()

Dieter Weber requested to merge weber/empyre:colorclipping into master
  • Clip saturation and luminance separately to make sure the result is clipped at the maximum possible saturation or luminance
  • Ensure that the argument of np.arccos(...) is within the allowed range to avoid NaN

Previously, clipping led to very strange colors in the result.

  • Evaluate how the result is changed in more use cases. Since there's no global R_max anymore, the automated "full range" will go to higher saturation values now, and luminance and saturation are no longer on the same scale but adjusted independently. This will probably lead to more contrast in plots where x, y and z have different ranges. It should be checked if the "color bar" and the display still match.

Merge request reports