Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改R中通知的颜色_R_Shiny_Shinywidgets - Fatal编程技术网

更改R中通知的颜色

更改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

我正在尝试使用函数“showNotification”显示绿色弹出窗口。
官方文档说,您可以使用参数“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