rstudio / thematic

Theme ggplot2, lattice, and base graphics based on a few simple settings.
https://rstudio.github.io/thematic/
Other
244 stars 10 forks source link

don't fail if default device isn't usable & avoid device leakage #68

Closed cpsievert closed 3 years ago

cpsievert commented 3 years ago

Closes #67

Testing notes

Install remotes::install_github("rstudio/thematic") and run the following app. Before this fix, you'd just see an error message in the app. Now you should see a plot (errors and warnings in the console are OK).

library(shiny)
thematic::thematic_shiny(font = "auto")
opts <- options(device = function() stop("boom"))
onStop(function() options(opts))
ui <- fluidPage(
  tags$style(HTML("body{background:black; color:white}")),
  plotOutput("p")
)
server <- function(input, output, session) {
  output$p <- renderPlot(plot(1:10))
}
shinyApp(ui, server)
cpsievert commented 3 years ago

Merging before tests run since GHA is down