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

Structure viewer legend doesn't update when changing the color scheme. #355

Open
janosh opened this issue Jul 15, 2023 · 1 comment
Open
Labels
bug ui Styles, CSS, interactivity controls

Comments

@janosh
Copy link
Member

janosh commented Jul 15, 2023

Visited https://next-gen.materialsproject.org/toolkit and selected "Accessible" from the "Change color scheme" dropdown.

Screenshot 2023-07-15 at 3 34 18 PM

The colors in the legend no longer match the ball and stick colors in the viewer.

Screenshot 2023-07-15 at 3 33 28 PM

@janosh janosh added bug ui Styles, CSS, interactivity controls labels Jul 15, 2023
@janosh
Copy link
Member Author

janosh commented Jul 15, 2023

This clientside callback looks like it might be the place to fix. Not sure if it should trigger some other callback or update the legend itself. Probably former.

app.clientside_callback(
"""
function (colorScheme, radiusStrategy, drawOptions, displayOptions) {
const newDisplayOptions = {...displayOptions}
newDisplayOptions.color_scheme = colorScheme
newDisplayOptions.radius_strategy = radiusStrategy
newDisplayOptions.draw_image_atoms = drawOptions.includes('draw_image_atoms')
newDisplayOptions.bonded_sites_outside_unit_cell = drawOptions.includes(
'bonded_sites_outside_unit_cell'
)
newDisplayOptions.hide_incomplete_bonds = drawOptions.includes('hide_incomplete_bonds')
return newDisplayOptions
}
""",
Output(self.id("display_options"), "data"),
Input(self.id("color-scheme"), "value"),
Input(self.id("radius_strategy"), "value"),
Input(self.id("draw_options"), "value"),
State(self.id("display_options"), "data"),
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ui Styles, CSS, interactivity controls
Projects
None yet
Development

No branches or pull requests

1 participant