![](/img/trans.png)
[英]How to change background color and text color of a titlePanel in R Shiny?
[英]R Shiny: How to change background color of a table
我發現如何在Shiny中更改用戶界面的背景顏色。 我發現的撤銷是它還使用tableOutput
顯示我正在顯示的表格的背景。 這里我展示一個虛擬的例子。
ui.R
shinyUI(pageWithSidebar(
headerPanel( “假”),
sidebarPanel(標記為$ hr()),mainPanel中(
# This is what I use to change the background color list(tags$head(tags$style("body {background-color: #ADD8E6; }"))), tableOutput("dummy") ) ))
server.R
shinyServer(函數(輸入,輸出){output $ dummy < - renderTable({data.frame(A = 1:4,B = 2:5,C = rep(“aaa”,4))})})
我得到的就是這個
我想得到什么(我使用GIMP重新創建)是
謝謝大家的幫助!
已經在閃亮的谷歌群體上給出了一個解決方案:
runApp(
list(ui = bootstrapPage(pageWithSidebar(
headerPanel("Rummy"),
sidebarPanel( tags$hr() ),
mainPanel(
tableOutput("dummy"),
# change style:
tags$head(tags$style("#dummy table {background-color: red; }", media="screen", type="text/css"))
)
)
)
,
server = function(input, output) {
output$dummy <- renderTable({ data.frame(A=1:4,B=2:5,C=rep("aaa",4)) })
}
)
)
我還邀請您閱讀有關閃亮的Google群組的討論,該群組展示了如何使用pander包生成html表格並將其插入閃亮的應用程序中。 這樣可以更靈活地控制樣式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.