r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
718 stars 336 forks source link

`plot()` outputs require white background (or white lines?) for the dark mode website #2729

Open avallecam opened 3 months ago

avallecam commented 3 months ago

Currently, the plot() outputs are lost in the background when the dark mode is used.

Possibly the standard suggested action to do would be to try to keep the default white background.

reference link: https://pkgdown.r-lib.org/articles/test/rendering.html

image

jayhesselberth commented 3 months ago

I think this is expected behavior as the default background color for base plots is transparent.

I set the background color to white in #2730 and the preview looks fine in dark mode.

Given this just another plot tweak, I think we'd leave it to users to set up parameters, and just leave this test in the vignette as a reminder of the issue.

avallecam commented 3 months ago

I agree with the approach to let users set up the parameter. Thanks for adding that test to the vignette!

hadley commented 3 months ago

Hmmm, are you sure we shouldn't set the background colour with css?

jayhesselberth commented 3 months ago

Added the CSS approach to #2730, works fine so long as we explicitly set the logo background to transparent.

Or maybe we should only set background to white if dark-mode is active?

jayhesselberth commented 3 months ago

Are we not adding a CSS class to plot images? Would make it easier to target their backgrounds specifically.