Adding image to gt header

I'm doing a table and need to add an image to the header, but the result is not as expected. Reproducible example:

library(gt)
dplyr::tibble(
        x = 1:5, ouch = 6:10
) %>%
        gt() %>%
        cols_label(
                x = img_header(
                        "",
                        "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Yellow_card.svg/200px-Yellow_card.svg.png",
                        height = 80
                )
        )

Output:

How can I rid the black line below the yellow card? (Is not in the original image)

Solution below:

library(gt)
dplyr::tibble(
        x = 1:5, ouch = 6:10
) %>%
        gt() %>%
        cols_label(
                x = img_header(
                        "",
                        "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Yellow_card.svg/200px-Yellow_card.svg.png",
                        height = 80, palette = "white"
                )
        )

Simply add palette = same colour that header background to your code.

Rplot

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.