rstudio / gt

Easily generate information-rich, publication-quality tables from R
https://gt.rstudio.com
Other
2.04k stars 211 forks source link

It is not possible to apply a style to the bottom border of a spanner with `tab_style()` #1671

Open pedrotercero3 opened 6 months ago

pedrotercero3 commented 6 months ago

Description

When adding a spanner to a table, it is not possible to change the style of the bottom border using tab_style().

Reproducible example

library(gt)

exibble |>
  dplyr::select(-fctr, -currency, -group) |>
  gt(rowname_col = "row") |>
  tab_spanner(
    label = "dates and times",
    columns = c(date, time, datetime),
    id = "dt"
  ) |>
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_spanners(spanners = "dt")
  ) |> 
  tab_style(
    style = cell_borders(
      sides = "all",
      color = "green",
      weight = px(5)
    ),
    locations = list(
      cells_column_labels(columns = c(date, time, datetime)),
      cells_column_spanners(),
      cells_title(),
      cells_body()
    )
  )

Expected result

The line inside the red oval should be green like the rest of the other lines:

image

Session info

Session info ``` R version 4.3.2 (2023-10-31) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Sonoma 14.1.1 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0 locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 time zone: Europe/Madrid tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] gt_0.10.1.9000 loaded via a namespace (and not attached): [1] digest_0.6.34 utf8_1.2.4 R6_2.5.1 fastmap_1.1.1 [5] tidyselect_1.2.0 magrittr_2.0.3 glue_1.7.0 tibble_3.2.1 [9] htmltools_0.5.7 pkgconfig_2.0.3 dplyr_1.1.4 generics_0.1.3 [13] lifecycle_1.0.4 xml2_1.3.6 cli_3.6.2 fansi_1.0.6 [17] sass_0.4.8.9000 vctrs_0.6.5 withr_3.0.0 compiler_4.3.2 [21] rstudioapi_0.15.0 tools_4.3.2 pillar_1.9.0 rlang_1.1.3 ```
olivroy commented 2 months ago