更改R中通知的颜色
我正在尝试使用函数“showNotification”显示绿色弹出窗口。更改R中通知的颜色,r,shiny,shinywidgets,R,Shiny,Shinywidgets,我正在尝试使用函数“showNotification”显示绿色弹出窗口。 官方文档说,您可以使用参数“type”来更改颜色 type A string which controls the color of the notification. One of "default" (gray), "message" (blue), "warning" (yellow), or "error" (red). 以前有人试过吗? 有没有办法使用HTML/十六进制代码 更新 我最终对单一类型的Sho
官方文档说,您可以使用参数“type”来更改颜色
type A string which controls the color of the notification. One of "default" (gray), "message" (blue), "warning" (yellow), or "error" (red).
以前有人试过吗?有没有办法使用HTML/十六进制代码
更新
我最终对单一类型的ShowNotification重新着色,如下所示:
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"
)
})
}
)
所以我所有的弹出窗口都是相同的颜色,对吗?可以为颜色添加id吗?假设您的代码id为“暗”,如果我使用“type=dark”,弹出窗口变暗,“type=error”仍然为红色?请查看具有
style
功能的shinyBS
包