Skip to content

Conversation

@ajwells128
Copy link

Implement dark mode for explanation.show_in_notebook method by post-processing the formatted HTML.

Without this, in a notebook that is rendered in dark mode, the text is scarcely legible.

Example (from tutorial):
show_in_notebook_dark_mode

if (dark_mode):
out = out.replace("\"black\"", "\"white\"")
out = out.replace("all: initial;", "all: initial; color: white;")
out = re.sub(r"svg.append\('text(((?!fill).)*);", r"svg.append('text\1.style('fill', 'white');", out)
Copy link
Author

Choose a reason for hiding this comment

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

This regex finds all svg texts (which don't adhere to any css or html color styling) for which a color is not specified (to avoid touching the purposefully colorful words) and decorates them with another style (fill: white)

@AbhiGaunker
Copy link

So is this resolved or not @ajwells128 ?

@ajwells128
Copy link
Author

So is this resolved or not @ajwells128 ?

The PR is still open and has been unreviewed as far as I know. The code worked just fine last I checked it, not sure if any changes have been made since then. I don't have permission to merge the PR, though. If you are interested in benefitting from dark mode yourself before the PR merges, you can install the package in the usual way and then make these changes to the library files if you wish.

@spook95
Copy link

spook95 commented Dec 20, 2023 via email

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.

3 participants