title: How do I change the color of an infobox in shinydashboard based on a string, not a value?
body: <p>I have been trying to change the color of the <code>InfoBox</code> if the entry is &quot;x&quot; or &quot;y&quot;. I found this question here: <a href="https://stackoverflow.com/questions/32301306/how-do-i-change-the-color-of-an-infobox-in-shinydashboard-based-on-the-value-dis">How do I change the color of an infobox in shinydashboard based on the value displayed</a>. The answer given works for numerical data, but I can't get to work with string. Here is a reproducible code that works with numerical values.</p>
  <pre><code>```{r library and source, eval= FALSE }
  
  library(shiny)
  library(shinydashboard)
  
  ```
  
  
  ```{r UI, eval = FALSE}
  ui &lt;- dashboardPage(
    #Header
    dashboardHeader(title = &quot;dashboard&quot;),
    
    #Sidebar with download button
    dashboardSidebar(width = 130),
    
    #Body
    dashboardBody ((box
                    (
                      width = 6,
                      textInput(&quot;wt1&quot;, &quot; Choose wt:&quot;, &quot;&quot;)
                    )),
                   
                   infoBoxOutput(&quot;Output&quot;))
  )
  
  ```
  
  ```{r Server, eval = FALSE}
  
  server &lt;- function(input, output, session) {
    output$Output &lt;- renderInfoBox({
      InfoTotal &lt;- paste(input$wt1, &quot;&quot;)
      
      if (input$wt1 &gt; 2)
      {
        infoBox(
          &quot;Change colors, please&quot;,
          InfoTotal,
          icon = icon(&quot;tint&quot;, lib = &quot;glyphicon&quot;),
          color = &quot;red&quot;
        )
      }
      else
        
      {
        infoBox(
          &quot;Change colors, please&quot;,
          InfoTotal,
          icon = icon(&quot;tint&quot;, lib = &quot;glyphicon&quot;),
          color = &quot;blue&quot;
        )
      }
      
      
    })
    
    
  }
  
  shinyApp(ui, server)
  
  ```
  </code></pre>
  <p>Also, it doesn't work for me is I try <code>if (input$wt1 = 2)</code> instead of <code>&gt; 2</code>. Any ideas?</p>