HTML vignettes with dark themed IDE

HTML Vignettes that render nicely with a white background may not render as nicely with a dark themed IDE. This begs the following questions:

  • What best practices are recommended for generating HTML vignettes that are IDE theme color neutral? (any sample templates are welcome)

  • Can an HTML vignette impose a white (or any other color) background thus overriding the IDE's default background?

1 Like

I believe you can add a custom style sheet to the HTML vignette

vignette_format

1 Like

Unfortunately, a CSS tag like

body { background-color: white;}

seems to be overridden by the RStudio color theme (but is properly rendered in a web browser).

What version of Rstudio are you using? Also, what operating system. I created a vignette for a package on my mac over the weekend, I use the dark theme but I remember it being very readable.

Also, I was wondering if you see a difference viewing the vignette in the viewer, or in it's own window?

I'm on RStudio version 1.1.383 running on a Windows 7 desktop. And yes, I see a difference viewing the vignette in the Help viewer vs. its own window. In the latter, the background color renders properly, in the Help viewer it defaults to the background theme color. A plain vanilla test package can be downloaded from here (this is the default devtools package + default vignette + custom CSS file). The background vignette color should be a dull yellow.