Repository navigation
Apply classes from the image output metadata - #731
Merged
bsipocz merged 1 commit intoOct 19, 2026
Merged
Conversation
Image outputs can already set their width and height in the output metadata, but classes were ignored. Add them to the classes from the cell metadata, so each image output of a cell can be styled separately, e.g. with the only-light / only-dark classes of a theme. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
bsipocz
approved these changes
Oct 19, 2026
bsipocz
left a comment
Member
There was a problem hiding this comment.
This looks reasonable and as it fixes a downstream issue, let's go ahead with the merge.
Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Image outputs can already set their
widthandheightin the output metadata (#588), butclassesare ignored. With this PR they are added to the classes from the cell metadata, so each image output of a cell can be styled separately.only-light/only-darkclasses, e.g.display(fig, metadata={"image/png": {"classes": "only-dark"}}). We do this in the xarray docs (Show matplotlib figures in the docs with a dark mode version pydata/xarray#11758), which currently has to monkeypatchNbElementRenderer.render_imagefor it.metadata_image_output.ipynband documents output metadata in "Images and Figures".AI disclosure: written with the help of Claude Code, reviewed and tested by me.
🤖 Generated with Claude Code