我有一个闪亮的应用程序,用户可以选择下载数据。弹出一个提示,提示他们输入用户名。如果他们的用户名与列表匹配,则可以下载数据。如何将inputPlaceholder = "enter_username"文本的颜色更改为较深的颜色?此外,如何将闪亮警报中取消按钮的颜色更改为红色?在用户界面中,我尝试使用CSS指定颜色,但没有成功。我检查了网页,试图确定正确的命名。
在哪里可以找到有关使用CSS指定用户界面调整的更多信息?
服务器
library(shiny)
library(shinyalert)
data <- data.frame(x=rnorm(10),y=rnorm(10))
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
# render data selection
output$cap_table <- DT::renderDataTable(data)
# Data download
observeEvent(input$cap_download, {
shinyalert(title = "Pump the breaks!",
text = "Did you get approval for data use from the data owners?",
type = "input", closeOnClickOutside = T, showCancelButton = T, inputId = "cap_download_btn",
showConfirmButton = T, confirmButtonText = "Confirm", cancelButtonText = "Cancel",
animation = "slide-from-top", inputPlaceholder = "enter_username")
})
observeEvent(input$cap_download_btn,{
if(input$cap_download_btn %in% credentials$user)
showModal(modalDialog(downloadButton("cap_dwnld", "Download"), footer = NULL, easyClose = T, size = "s"))
})
output$cap_dwnld <- downloadHandler(
filename = function(){"insert_name.csv"},
content = function(file) {
shiny::withProgress(
message = paste0("Downloading Capture Data"),
value = 0,
{
shiny::incProgress(3/10)
Sys.sleep(1)
shiny::incProgress(9/10)
write.csv(cap_data(), file, row.names = FALSE)
}
)
}
)
用户界面
library(shiny)
library(shinyalert)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
# BUTTON THEMEING - THIS WHERE I NEED HELP
tags$style(HTML('.alert .confirm {background-color: #2874A6 !important;}')),
tags$style(HTML('.alert .cancel {background-color: #2874A6 !important;}')),
tags$style(HTML('.alert .test {background-color: #2874A6 !important;}')),
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
),
# Show a plot of the generated distribution
mainPanel(
DT::dataTableOutput("cap_table"),
useShinyalert(),
actionButton('cap_download',"Download the data")
)
)
))