executablebooks / MyST-NB

Parse and execute ipynb files in Sphinx
https://myst-nb.readthedocs.io
BSD 3-Clause "New" or "Revised" License
211 stars 84 forks source link

MyST-nb injects CSS for ipywidgets that ignores dark mode #618

Open flying-sheep opened 3 months ago

flying-sheep commented 3 months ago

Describe the bug

context

When adding a output to a ipywidgets widget, e.g. a <table class=table>…</table> to a VBox, the resulting style partially ignores dark mode.

image image

expectation I expected tables and ipywidget UI to be dark-mode aware.

I expect CSS for cell output to never use hardcoded colors, but always CSS variables.

bug But instead light-on-dark elements appear in the cell output

problem This is a problem because it’s ugly and every second line is unreadable.

Reproduce the bug

See https://github.com/flying-sheep/session-info2/blob/da3827c26259211e3a0d2effa9695422436fe562/src/session_info2/_widget.py#L39-L43

Which results in this HTML: https://session-info2.readthedocs.io/en/latest/

Specifically this applies:

div.cell_output tbody tr:nth-child(odd) {
  background: #f5f5f5;
}

Please never use hardcoded colors in CSS, only variables

List your environment

flying-sheep commented 1 day ago

Hi @agoose77 do you have any ideas how the maintenance situation here can be improved? I’d like to try my hand at fixing this, but my experience with https://github.com/executablebooks/MyST-NB/pull/597 is suggesting that doing so would need a lot of prodding and patience on my part.

I’d love to contribute if feedback, PR merges, and releases would be halfway quick. Is there a way we can make that happen?