[英]Change color of notification in R shiny
我正在嘗試使用功能“showNotification”來顯示綠色彈出窗口。
官方文檔說,你可以使用參數'type'來改變顏色。
type A string which controls the color of the notification. One of "default" (gray), "message" (blue), "warning" (yellow), or "error" (red).
有沒有人試過這個?
有沒有辦法使用 HTML/HEX 代碼?
更新
我最終對單一類型的 showNotifications 重新着色,如下所示:
tags$head(tags$style(HTML('
.shiny-notification-error {
background-color:#FF5757;
color:#000000;
}
.shiny-notification-message {
background-color:#B5E26F;
color:#000000;
}
'))),
您可以自己添加一些樣式:
library(shiny)
shinyApp(
ui = fluidPage(
tags$head(
tags$style(
HTML(".shiny-notification {background-color:#112446;}")
)
),
actionButton("show", "Show")
),
server = function(input, output) {
observeEvent(input$show, {
showNotification("Message text",action = a(href = "javascript:location.reload();", "Reload page"),type = "warning"
)
})
}
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.