R 如何更改主题

R 如何更改主题,r,shiny,themes,dt,R,Shiny,Themes,Dt,我想将黑色主题应用于闪亮的应用程序: library(shinythemes) shinyUI(fluidPage( theme = shinytheme("cyborg"), ...) 但是DT数据表不遵循主题颜色 我怎样才能把它弄暗 非常感谢。除了发布的代码外,还必须将以下参数添加到datatable函数中。完全可复制的代码如下 library(shiny) library(DT) library(shinythemes) ui <- flu

我想将黑色主题应用于闪亮的应用程序:

    library(shinythemes)

    shinyUI(fluidPage(
      theme = shinytheme("cyborg"),
     ...)
但是DT数据表不遵循主题颜色

我怎样才能把它弄暗


非常感谢。

除了发布的代码外,还必须将以下参数添加到datatable函数中。完全可复制的代码如下

library(shiny)
library(DT)
library(shinythemes)

ui <- fluidPage(
  theme = shinytheme("cyborg"),
  mainPanel(
    DTOutput("table")
  )
)

server <- function(input, output){
    output$table <- renderDT({
      datatable(iris,
                style = "bootstrap" # <--------- This is the crucial part
      )
    })
}

# Create Shiny app ----
shinyApp(ui, server)


我认为您应该将DT切换为bootstrap样式,以便css也应用于表。在DT通话中使用style='bootstrap'。好的,谢谢,现在我明白了。下载bootstrap.css并将其复制到目录中,然后使用style='bootstrap'调用DT。Thanks在datable调用中将样式设置为bootstrap,其余的都已经存在了。