Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
atlight opened this issue Sep 5, 2024 · 0 comments
Open

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

atlight opened this issue Sep 5, 2024 · 0 comments

Comments

@atlight
Copy link

atlight commented Sep 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant