knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(tibble)
library(bs4cards)

By default the label_colour argument is set to NULL, and is interpreted as a CSS value of "inherit". However, you can override this and set the card label colour manually. The label_colour argument will accept any valid colour string recognised by R. The input can either be a single colour or a vector assigning each card a different label colour:

galleries[1:3, ] %>% 
  cards(
    title = long_name,
    text = blurb,
    link = gallery_url,
    image = image_url,
    label_colour = c("#d6cadd", "antiquewhite", "#c4d8e2")
  )

For inset layouts, the colour needs to be partly transparent if you want the image underneath to show through:

galleries[1:3, ] %>% 
  cards(
    title = long_name,
    text = blurb,
    link = gallery_url,
    image = image_url,
    layout = "inset-bottom",
    label_colour = c("#d6caddaa", "#ffffffaa", "#c4d8e2aa"),
    breakpoint = 5
  )


djnavarro/bs4cards documentation built on Dec. 20, 2021, 12:04 a.m.