Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inverting functionality? #105

Closed
andrew-s28 opened this issue Feb 14, 2024 · 3 comments · Fixed by #106
Closed

Add inverting functionality? #105

andrew-s28 opened this issue Feb 14, 2024 · 3 comments · Fixed by #106

Comments

@andrew-s28
Copy link
Contributor

I am hoping to get some thoughts on adding functionality for cmocean colormaps with inverted lightness. Here is an example of what this looks like:
image

This functionality is included in the MATLAB cmocean toolbox and some of my collaborators have made good use of it. A specific use case cited in the MATLAB example is using diverging colormaps on light backgrounds.

I see three ways this could be added:

  1. Include _i or _inverted colormaps in the cm.py file for direct access by users.
  2. Include an invert_lightness function in the tools.py file.
  3. Allow negative alpha values in the cmocean.tools.lighten to be interpreted as inverting lightness

One issue is that the solution I have for inverting lightness requires an additional dependency, colorspacious. Although this is already a dependency for the "cmocean[plots]" install, so perhaps not a huge leap.

@kthyng
Copy link
Contributor

kthyng commented Feb 15, 2024

@andrew-s28 I didn't know is an option in the Matlab toolbox! Cool! Yeah this would be useful. Any chance you can start on a PR?

@andrew-s28
Copy link
Contributor Author

I would be happy to. I should be able to get something together for a PR in the next few days. Thanks for your consideration!

@kthyng
Copy link
Contributor

kthyng commented Feb 15, 2024

Sounds great @andrew-s28! Let me know if you have questions along the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants