Skip to content

google_font() does not seem to work when passed as a list into tab_style()  #661

@kaustavSen

Description

@kaustavSen

When passing google_font() as a list into tab_style(), it does not seem to work, i.e. the font face does not change.

library(gt)

mtcars %>%
  head() %>% 
  gt() %>% 
  tab_style(
    style = list(
      cell_text(font = google_font("Fira Code")),
      cell_fill(color = "#F5F3F1")
    ),
    locations = cells_body(everything())
  )

image

However, if I pass it as two separate calls to tab_style() and not as a list():

  • one for changing the font-face
  • second for updating the background color of the cells

then it works:

mtcars %>%
  head() %>% 
  gt() %>% 
  # First call to change font-face
  tab_style(
    style = cell_text(font = google_font("Fira Code")),  # without list()
    locations = cells_body(everything())
  ) %>% 
  # Second call to update background color
  tab_style(
    style = cell_fill(color = "#F5F3F1"),  # without list()
    locations = cells_body(everything())
  )

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions