Search code examples
rshinyformatdtshinyscreenshot

screenshotButton() does not render styleColorBar from formatStyle on Shiny


When I want to take a screenshot of a Shiny page using the shinyscreenshot library, the ColorBar style does not appear in the screen.

Minimum reproducible example:

library(shiny)
library(shinyscreenshot)

shinyApp(ui = fluidPage(datatable(iris['Sepal.Length']) %>% formatStyle(1, background = styleColorBar(iris['Sepal.Length'], 'blue')),
                        screenshotButton()
                        ),
         server = function(input, output, session) {})

Shiny application and screenshot

Thank you


Solution

  • If it can help others: use the capture package as suggested by Stéphane instead of shinyscreenshot, but if you want to capture a fluidRow it will not behave well, so it’s better to add a div around that fluidRow and capture the div.