I'd like to colour an entire row based on the values in one column using the R package gt. What I'd like is shown below, where rows are red for the smallest values of mpg, and blue for the highest values.
Using the code below:
mtcars |>
head() |>
select(mpg, cyl, disp, drat) |>
gt() |>
data_color(
columns = mpg,
colors = scales::col_numeric(
palette = c("red", "orange", "green", "blue"),
domain = c(18, 23))
)
Gives the right behaviour only for the mpg column itself.


