Search code examples
rshinyopacityr-leaflet

Control transparency level of the Leaflet layer box inside shiny app


I am working on a shiny app that displays a Leaflet map, and I would like to make the layer box that appears in the upper right corner of the map transparent, but without changing the transparency level of the name of my layers. In my .css file that I include inside the application I have added the following code to control the appearance of the layer box:

.leaflet-control-layers{ 
    width:auto;
    height: 500px;
    padding-top:36px;
    opacity:  0.70;
}

but by using the "opacity" argument also the text becomes more or less opaque. Do you have any suggestion on I should proceed?


Solution

  • In your .css file just control the parameter "background-color" and set it to "transparent":

    .leaflet-control-layers{
     background-color: transparent;}