如何更改 Shinymanager 登录页面的颜色?

How to change the color of the Shinymanager Login Page?

我正在尝试更改 shinymanager 包中登录页面的色调。 我看过这些帖子:

  1. Change the color tone of a shinytheme

但是,由于我对 CSS 了解不多,所以我正在努力解决这个问题。

这是一个可重现的例子:

library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(shinymanager)

credentials <- data.frame(
  user = c("shiny"),
  password = c("shiny"),
  stringsAsFactors = FALSE
)

css <- HTML(" body {
    background-color: #0dc5c1;
}")

ui <- dashboardPage(
  
  dashboardHeader(title = "Dashboard"),
  ## Sidebar content
  dashboardSidebar(
    sidebarMenu(
      menuItem("App1", tabName = "App1", icon = icon("th"))
      
    )
  ),
  
  dashboardBody(
    fluidRow(
      tabItems(
        
        tabItem(tabName = "App1",
                sidebarPanel(
                  numericInput("num",
                               "Select a number",
                               min = 1,
                               value = 10),
                  
                  sliderInput("slider1",
                              "Number of bins:",
                              min = 1,
                              max = 50,
                              value = 30),
                  checkboxInput("remove", "Remove...", value = FALSE),
                  
                  
                  
                ),
                mainPanel(
                  verbatimTextOutput("value"),
                  plotOutput("plot1"),
                  
                )
                
        )
    )
  )
)
)

ui <- secure_app(ui,
                 # changing theme for the credentials
                 
                 theme = shinythemes::shinytheme("united"),
                 tags_top = tags$div(
                   tags$head(tags$style(css)),
                   tags$img(
                     src = "https://marketplace.egi.eu/101-large_default/the-r-project-for-statistical-computing.jpg", width = 200, height = 200, alt="Logo not found", deleteFile=FALSE
                   ))
)

server <- function(input, output, session) {
  
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )
  
}

shinyApp(ui, server)

我的objective是把登录页面的颜色改成#0dc5c1下面的颜色,特别是页面的边框和按钮。

我尝试添加:

css <- HTML(" body {
        background-color: #0dc5c1;
    }")

但是没用。

有人知道怎么解决吗?

非常感谢

我修改了CSS.

ui <- secure_app(ui,
                 # changing theme for the credentials
                 
                 theme = shinythemes::shinytheme("united"),
                 tags_top = tags$div(
                   tags$head(
                     tags$style(
                       ".row {
                       background-color: #0dc5c1;"
                     ), 
                     tags$style(
                       ".panel-body {
                       background-color: #0dc5c1;"
                     ),
                     tags$style(
                       ".panel-auth {
                       background-color: #0dc5c1;"
                     )
                   ),
                   tags$img(
                     src = "https://marketplace.egi.eu/101-large_default/the-r-project-for-statistical-computing.jpg", width = 200, height = 200, alt="Logo not found", deleteFile=FALSE
                   ))
)

我不确定应该更改背景颜色的确切位置。如果太多,只需删除一些 CSS.

请检查以下内容:

library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(shinymanager)

credentials <- data.frame(
  user = c("shiny"),
  password = c("shiny"),
  stringsAsFactors = FALSE
)

css <- HTML(".btn-primary {
                  color: #ffffff;
                  background-color: #0dc5c1;
                  border-color: #0dc5c1;
              }
              .panel-primary {
                  border-color: #0dc5c1;
              }")

ui <- dashboardPage(
  
  dashboardHeader(title = "Dashboard"),
  ## Sidebar content
  dashboardSidebar(
    sidebarMenu(
      menuItem("App1", tabName = "App1", icon = icon("th"))
      
    )
  ),
  
  dashboardBody(
    fluidRow(
      tabItems(
        
        tabItem(tabName = "App1",
                sidebarPanel(
                  numericInput("num",
                               "Select a number",
                               min = 1,
                               value = 10),
                  
                  sliderInput("slider1",
                              "Number of bins:",
                              min = 1,
                              max = 50,
                              value = 30),
                  checkboxInput("remove", "Remove...", value = FALSE),
                  
                  
                  
                ),
                mainPanel(
                  verbatimTextOutput("value"),
                  plotOutput("plot1"),
                  
                )
                
        )
      )
    )
  )
)

ui <- secure_app(ui,
                 # changing theme for the credentials
                 
                 theme = shinythemes::shinytheme("united"),
                 tags_top = tags$div(
                   tags$head(tags$style(css)),
                   tags$img(
                     src = "https://marketplace.egi.eu/101-large_default/the-r-project-for-statistical-computing.jpg", width = 200, height = 200, alt="Logo not found", deleteFile=FALSE
                   ))
)

server <- function(input, output, session) {
  
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )
  
}

shinyApp(ui, server)