HEX code passed to the color
parameter of any Pyplot plots/patches/fills results in incorrect color being rendered.
To reproduce:
from matplotlib import pyplot as plt
plt.fill_between([0,1],[1,1],[2,2], color='#CCCCCC')
plt.fill_between([0,1],[0,0],[1,1], color='#7818FE')
plt.show()
I expect '#7818FE' to be drawn, but '#601BFE' appears instead. Similarly, plotting '#CCCCCC' results in '#BEBDBE' instead.
I don't think this is simply compression artefact, because I have tried to save it as PNG and still the colors are (way) off. Color space issue maybe?
This issue matters because our team has to draw infographics exactly as specified by our designers, and the colors are so wrong that even a red-green color-blind team member can tell the difference between the incorrect colors, in shades of red/green, visually...
The issue is so glaringly obvious that I expect it to have been asked before, but I can't seem to find any relevant question. If this is a duplicate I apologize.
I have also opened an issue on GitHub.
Thanks for the tip in the comments about trying a different color picker! I was using an app called Sip in my question.
I tried Chrome's color picker and the result is even more incorrect:
However, Mac's preinstalled Digital Color Meter gets me the same value @ImportanceOfBeingErnest has gotten,
#7819FE
, after I specifically selected sRGB color space:To fix the problem for all color picker tools, I have to switch my monitor's color profile from the default HD 709-A to sRGB in System Preferences -> Displays -> Color:
The reason why Mac picks a video color space as default instead of the web standard sRGB escapes me. (I know sRGB is bad, still...) Since this is a Mac problem I consider the issue solved. Thanks for the help!