'in shiny, when i convert this logo to action button, a gray background appear, how to fix this

as the image here,

image
(source: qhmqk.me)

gray background appears once i convert the logo to action button, i need the logo to be transparent once again, before converting the image to action button there is no background and the logo area is totally transparent

title <- tags$a(href= NULL, tags$button(id = "shinylogo",class = "btn action-button", img(src ="BM_fl.png",height = '55',  style = "padding-bottom:20px;border-radius: 0px;
                   border-width: 0px")))


Solution 1:[1]

You could overwrite the background-color property by adding some additional CSS. Working example below, hope this helps!

library(shiny)

ui <- fluidPage(
  tags$a(href= NULL, 
         tags$button(id = "shinylogo",
                     class = "btn action-button", 
                     style='background-color:transparent',
                     img(src ="https://www.pngkey.com/png/full/139-1398300_r-shiny-logo.png",
                         height = '55',  
                         style = "padding-bottom:20px;border-radius: 0px;border-width: 0px"
                     )
         )
  )
)

server <- function(input, output, session) {
}

# Run the application 
shinyApp(ui = ui, server = server)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Florian