Dark-mode plot inversion doesn't cover layout-ncol/layout panel figures
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- bootstrap, r, scss
- Domain
- documentation, web-dev
Research direction
Start in BS5/assets/pkgdown.scss and inspect the invert-filter mixin alongside its existing Quarto selectors. Reproduce the issue with a qmd article using layout-ncol, then toggle dark mode and verify that layout-panel plot images invert like ordinary chunk figures. Done when the layout-panel figures switch correctly without changing other plot handling.
Written by the indexing model from the issue text.
Description
pkgdown's Bootstrap 5 template auto-inverts rendered plot images in dark mode via the invert-filter mixin in BS5/assets/pkgdown.scss:
@mixin invert-filter {
img.r-plt, // vignette figures
pre .r-plt.img img, // example figures
.cell-output-display img, // quarto figures
.html-widget {
filter: invert(100%) hue-rotate(180deg);
}
}
This works for ordinary chunk output, but quarto's layout-ncol/layout cell option renders figures inside a different wrapper — <div class="cell quarto-layout-panel"> / <div class="quarto-layout-cell"> — instead of .cell-output-display. None of the selectors above match that wrapper, so images placed via layout-ncol stay light-mode-only while every other plot on the page switches with the theme.
It seems to me that this is an oversight, since the same stylesheet special-cases .quarto-layout-cell .html-widget elsewhere, so layout-ncol appears to be an anticipated case, but the invert-filter mixin itself was just never extended to match.
To reproduce, add this to any qmd article, pkgdown 2.2.1:
```{r}
#| layout-ncol: 2
plot(1:10)
plot(10:1)
```
Toggle the site's light-switch to dark mode: ordinary chunk figures elsewhere on the page invert correctly; these two do not.
Suggested fix:
Add the layout-panel selector to the mixin:
@mixin invert-filter {
img.r-plt,
pre .r-plt.img img,
.cell-output-display img,
.quarto-layout-panel img, // <- add this one
.html-widget {
filter: invert(100%) hue-rotate(180deg);
}
}
Happy to open a PR with this change if useful.
- Dominant language
- R
- Stars
- 775
- Forks
- 355
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from r-lib/pkgdown
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enviPathR OpenBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Bioconductor/BiocContributions#207 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
datacarpentry/semester-biology#1255 ·