I'm trying to create a box in rshiny, which will have the background color set by the input variable. I've created an output:
mainPanel(
tags$div(uiOutput("image", align = "right"), h2(textOutput("text")),
div(textOutput("text2"),div(style = "width: 5px;"), "w",div(style = "width: 5px;"), textOutput("text3"), style = "display: flex"),
div("tel. ", div(style = "width: 5px;"), textOutput("num"), style = "display: flex"),
div("e-mail: ", div(style = "width: 5px;"), textOutput("text4"), style = "display: flex"),
style= "width: 800px; height: 400px;color: black; font-size:15px;
border: 5px solid white; padding: 15px; margin: 20px", class = "test")
)
And now I'd like to modify the background color with a input by this:
eventReactive(input$kolor, {
if(input$kolor == 1)
{
HTML('<style type="text/css">
.test { background-color: white; }
</style>')
}
else if(input$kolor == 2)
{
HTML('<style type="text/css">
.test { background-color: green; }
</style>')
}
else if(input$kolor == 3)
{
HTML('<style type="text/css">
.test { background-color: blue; }
</style>')
}
})
Unforunately, when I change the input variable - nothing happens. Any tips how to do it?