Skip to content

colors for hovertext in light and dark mode #556

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

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

Conversation

sneakers-the-rat
Copy link
Contributor

related to: #539
fixes: #532

sorry i couldn't help with this during the sprint - i puzzled over this for quite awhile in the initial implementation, i was just afk during those hours.

the basic problem is that plotly has a pretty messy way of handling styles. there isn't really a uniform way of passing style information through a complex plot object, and in particular it seems to accept full css expressions in some places, plotly-specific values other places - and probably most confusing, an undocumented subset of css in a third set of places.

font color seems to be one of those third places, where if you pass an rgb(x,y,z) string there, it works, but everything else is silently ignored (programming lesson for any newbies that may see this! fail loudly!) So while we're passing valid CSS through in the layout call, it silently strips it out, so those var(--bs-body-color) are just dropped and do nothing.

second layer of the problem is that plotly then injects its own inline CSS for all the generated svg objects. in css, styles that are applied directly on an element have the highest priority, so there isn't a way for us you override them except to use the accursed !important flag (and i couldn't find a way to tell plotly to just not inject styles.

@lwasser finding the correct class for the hover text is challenging here compared to a "normal" hover effect because it's not a css hover effect, but a JS-based one where the DOM element ceases to exist once you stop hovering. the only way i found to actually figure out what selector to use there is a sort of hack, where i hovered, right clicked, inspect element, and then positioned the element inspector underneath where my mouse would be on a prior opening so that the plotly JS wouldn't detect my mouse having moved (and thus remove the hover DOM element). super janky.

i sorta think at this point that just manually templating SVG would be easier than using plotly, but here we are.

Screenshot 2025-07-16 at 6 35 18 PM Screenshot 2025-07-16 at 6 35 09 PM

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.

fix: pop-up in the translation stats viz has dark text over dark background
1 participant