Customize colors of R shiny table using shinysky

235 views Asked by At

So, I know that with rhandsontable package, I could do something like this to color my table:

library(rhandsontable)

DF <- tail(iris,30)

rhandsontable(DF, readOnly = TRUE) %>%
  hot_cols(renderer = "
           function (instance, td, row, col, prop, value, cellProperties) {
           Handsontable.renderers.TextRenderer.apply(this, arguments);
           if (row == col) {
           td.style.background = 'lightgrey';
           } else if (col > row) {
           td.style.background = 'grey';
           td.style.color = 'grey';
           } else if (value < 3) {
           td.style.background = 'pink';
           } else if (value > 3) {
           td.style.background = 'lightgreen';
           }
           }")

However, this package doesn't allow me to do some things I need, so after searching, I started using shinysky. However, I can't find a way to change the colors of the table, just like I did in the example above.

Here's a minimal shiny example:

library(shinysky)

DF <- tail(iris,30)

server <- function(input, output, session) {

  table <- reactive({DF})
  output$hotable1 <- renderHotable(table(), readOnly = F)

}

ui <- fluidPage(fluidRow(column(8,hotable("hotable1"))))

shinyApp(server=server,ui=ui)

How could I customize the colors from this table?

Thank you

0

There are 0 answers