Skip to content

Use of 'white' iconColor results in black awesomeIcons  #930

@atlight

Description

@atlight

The use of the string 'white' as the iconColor for awesomeIcons results in black icons being displayed

library(shiny)
library(leaflet)

d <- data.frame(x=c(2, 3), y=c(7, 2))

ui <- leafletOutput('mymap')

server <- function(input, output, session) {
  output$mymap <- renderLeaflet({
    leaflet(d) %>% 
      addAwesomeMarkers(lng=~x, lat=~y,
                        icon=~awesomeIcons(library='fa',
                                           icon='plus-square',
                                           iconColor='white',
                                           markerColor='blue'))
  })
}

shinyApp(ui, server)

image

The issue is specific to the string 'white'. The equivalent hex code, '#ffffff', results in a white icon.

There is some special-casing of 'white' at

if ((options.iconColor === 'white' || options.iconColor === 'black') &&
options.prefix !== 'fa') {
iconColorClass = "icon-" + options.iconColor;
} else if (options.prefix === 'fa' && options.iconColor === 'white') {
iconColorClass = "fa-inverse";
} else {
iconColorStyle = "color: " + options.iconColor + ";";
which may be to blame.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions