简体   繁体   English

闪亮的仪表板和闪亮的主题?

[英]Shinydashboard and shinytheme?

I've made a dashboard with shinydashboard and really like the ease of making a layout with the package!我已经用 Shinydashboard 制作了一个仪表板,真的很喜欢用这个包制作布局的简易性! However, I'd like to use one of the themes from the shinythemes package.但是,我想使用shinythemes 包中的主题之一。 I'm familiar with the shinydashboard skins, but they aren't nearly as cool or modern as shinythemes.我熟悉闪亮的仪表板皮肤,但它们不像闪亮的主题那么酷或现代。 The shinythemes seem to work well with just shiny, but not with shinydashboard. Shinythemes 似乎只适用于 Shiny,但不适用于 Shinydashboard。

Anyone know how to get shinythemes to work with shinydashboard?任何人都知道如何让闪亮的主题与闪亮的仪表板一起工作?

Thanks very much!非常感谢!

ie: start of dashboard: doesn't work:即:仪表板的开始:不起作用:

 ui <- dashboardPage( theme = shinytheme("spacelab"),
 dashboardHeader(title = "I want this to look awesome!"),
 dashboardSidebar(sidebarMenu(

There is a package ( dashboardthemes ) that allows modifying shinydashboard themes.有一个包 ( dashboardthemes ) 允许修改shinydashboard主题。 It is pretty straightforward to use.使用起来非常简单。

One of the available skins:可用皮肤之一: 在此处输入图片说明

Alternatively, if you want to try some new skins go for semantic.dashboard which offers Bootswatch and Semantic-UI themes.或者,如果您想尝试一些新皮肤,请选择Semantic.dashboard ,它提供 Bootswatch 和 Semantic-UI 主题。

Unfortunately, shinydashboard isn't capable of switching to additional Bootstrap-based themes the way you're trying to do above.不幸的是, shinydashboard无法像您上面尝试的那样切换到其他基于 Bootstrap 的主题。

If you need to apply custom .css within your app, I would do something like the following:如果您需要在您的应用程序中应用自定义 .css,我会执行以下操作:

  dashboardBody(
    useShinyjs(),
    tags$head(
      tags$link(rel = "stylesheet", type = "text/css", href = "css/custom.css"),
      tags$link(rel = 'stylesheet', href = '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css')
    ),
    # Source add'l UI elements:
    tabItems(
      source('ui/charts.R', local = TRUE)[['value']],  # source: https://groups.google.com/forum/#!topic/shiny-discuss/kRBT8EmNsJg
      source('ui/help.R', local = TRUE)[['value']]
    )
  )

Where custom.css (or similar) is where you have your overridden UI elements defined. custom.css (或类似的)是您定义覆盖 UI 元素的地方。

If it's just the color scheme that you're trying to change, reference this post:如果只是您要更改的配色方案,请参考这篇文章:

How to change color in shiny dashboard? 如何在闪亮的仪表板中更改颜色?

You can also change the font in the headers section, and link it back to a google font:您还可以更改标题部分中的字体,并将其链接回谷歌字体:

 tags$head(tags$style(HTML("@import url('https://fonts.googleapis.com/css?family=News+Cycle');


                        h1 {
                            font-family:'News Cycle',sans-serif;
                            font-size: 48px;
                            font-weight: 1000;
                            line-height: 1.1;
                            color: 'slategrey';
                        }")))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM