tidyverse / reprex

Render bits of R code for sharing, e.g., on GitHub or StackOverflow.
https://reprex.tidyverse.org
Other
741 stars 80 forks source link

Ensure white background when rendering via `reprex:::preview()` #468

Closed yjunechoe closed 2 months ago

yjunechoe commented 2 months ago

This is an issue in visual display that first caught my eye transitioning form RStudio to Positron. I wasn't sure (and am still not quite sure) whether this issue belongs here or in Positron, but I decided to post here after a detour investigation (more details in this thread https://fosstodon.org/@yjunechoe/112997187221404762)

I'm a dark mode IDE user. In RStudio, reprexes have always rendered in the Viewer panel with a white background, regardless of editor theme. But in Positron, I'm seeing reprexes render with transparent background, and dark background sets a bad contrast against the contents of the reprex.

reprex::reprex("1")

image

Maybe this reflects a fundamental difference in how RStudio and Positron render Github flavored markdown in the Viewer. But in any case I can confirm that just injecting the background: white; css somewhere in the document can prevent the reprex from visually blending into the IDE background. So it would be nice if reprex:::preview() could guarantee a white-background hml at least when rendering interactively to the viewer, if that's a desirable behavior to hard-code.