【问题标题】:Easiest way to change the whole font in shiny app in R?在 R 的闪亮应用程序中更改整个字体的最简单方法?
【发布时间】:2020-08-16 14:38:57
【问题描述】:

我想知道如何在我闪亮的应用程序中更改整个字体系列。是否可以在我的整个代码之前过去任何内容?有模板吗?

我需要在 Ui 和 Server 中实现一些东西吗?

谢谢你:)

【问题讨论】:

标签: css r shiny


【解决方案1】:

你可以在ui组件中添加这样的东西;

tags$head(tags$style('body {font-family: Arial;}'))

在报价单中添加更多选项以进一步自定义;

tags$head(tags$style('
   body {
      font-family: Arial; 
      font-size: 20px; 
      font-style: italic;
   }'
))

【讨论】:

    【解决方案2】:

    你可以在here找到很多闪亮的主题

    library(shiny)
    library(shinythemes)
    shinyApp(
      ui = fluidPage(
        shinythemes::themeSelector(),  # <--- Add this somewhere in the UI
        sidebarPanel(
          textInput("txt", "Text input:", "text here"),
          sliderInput("slider", "Slider input:", 1, 100, 30),
          actionButton("action", "Button"),
          actionButton("action2", "Button2", class = "btn-primary")
        ),
        mainPanel(
          tabsetPanel(
            tabPanel("Tab 1"),
            tabPanel("Tab 2")
          )
        )
      ),
      server = function(input, output) {}
    )
    

    【讨论】:

      猜你喜欢
      • 2021-07-31
      • 2020-02-14
      • 1970-01-01
      • 2016-12-20
      • 2012-04-27
      • 2016-11-02
      • 1970-01-01
      • 2011-12-29
      • 2021-07-20
      相关资源
      最近更新 更多