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

WIP, ENH: early draft of color support #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tylerjereddy
Copy link
Contributor

  • The option to set the color of a molecule is pretty important for visual separation/clarity of i.e., MDAnalysis selections in ggmolvis. This is a likely-incorrect but fairly minimal set of demo changes that allows the color setting to work per molecule/selection for image renders (probably not movies yet) while still passing the tests locally.

[ci skip]

This branch was developed alongside the reference render script for flu virus visualization at tylerjereddy/render_north_star#3.

A sample render separating lipid and protein colors is below--does seem to be looking a bit nicer than default already. That said, there are still many improvements/fixes needed. For whatever reason, the metal surface option from #23 seems to be ignored with the default settings for this system--that's annoying...

image

* The option to set the color of a molecule is pretty important for
visual separation/clarity of i.e., MDAnalysis selections in `ggmolvis`.
This is a likely-incorrect but fairly minimal set of demo changes
that allows the color setting to work per molecule/selection for image
renders (probably not movies yet) while still passing the tests locally.

[ci skip]
@@ -8,6 +8,10 @@
class Color(Property):
"""Class for the color."""


def __init__(self, mol_obj, color):
self.colors = [color]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the current control flow--this may need to be adjusted to have an entry for each "frame." That seems a bit awkward--I suppose maybe there is a desire to change color on a per-frame basies.

color_dict = {"green": (0, 0.9, 0, 1.0),
"red": (1, 0, 0, 1.0),
"default": (0, 0, 0, 1.0),
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we could support a few defaults, a bit like VMD, but I'm pretty sure it would help for a user to be able to specify the RGBA tuple themselves as well, especially with all the resources/websites available for producing nice mixes of such values.

@BradyAJohnston
Copy link
Collaborator

BradyAJohnston commented Mar 10, 2025

I did mention this a bit here but I think this kind of coloring approach would be best handled by setting the color attributes on the mesh rather than through nodes. This would also allow users to potentially define functions that change color each frame based on some computed attribute.

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 this pull request may close these issues.

2 participants