我找到了如何更改 Shiny 中用户界面的背景颜色。我发现的提款是它还为我显示的表格的背景着色tableOutput
。这里我展示了一个虚拟示例。
ui.R
闪亮的UI(页面带侧边栏(
headerPanel("虚拟"),
侧边栏面板(
标签$hr() ),
主面板(
# This is what I use to change the background color
list(tags$head(tags$style("body {background-color: #ADD8E6; }"))),
tableOutput("dummy") ) ))
server.R
闪亮服务器(功能(输入,输出){输出$虚拟
我得到的是这个
我想要得到的是(我使用 GIMP 重新创建它)
感谢大家的帮助!
已经给出了解决方案闪亮的谷歌组 https://groups.google.com/forum/#!topic/shiny-discuss/lBg8IP2qToo:
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)) })
}
)
)
我还邀请您阅读闪亮的谷歌小组上的讨论,其中展示了如何使用pander包来生成 html 表格并将它们插入到闪亮的应用程序中。这样可以更灵活地控制样式。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)