diff --git a/NEWS.md b/NEWS.md index 7b4f91f2..93831390 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,7 @@ Bugs: * `save_tt("file.pdf")` works with colors. Thanks to @olivedv for the report and solution #395. * `group_tt(i=vec)`: `vec` can be a factor vector * `style_tt(align="d")` with empty strings (`modelsummary::datasummary_balance()` test) +* `style_tt(line_color)` accepts Hex codes. Thanks to @andrewheiss for report #415. * `tt(rownames=TRUE)` should not add column names if they do not exist. Thanks to @Nowosad for report #414. New: diff --git a/R/style_tabularray.R b/R/style_tabularray.R index a433ed69..0bad1cca 100644 --- a/R/style_tabularray.R +++ b/R/style_tabularray.R @@ -126,8 +126,11 @@ setMethod( rec$line[idx] <- sty$line[row] } - if (!is.na(sty$line_color[row])) { - rec$line_color[idx] <- sty$line_color[row] + lcol <- sty$line_color[row] + if (!is.na(lcol)) { + x <- color_to_preamble(x, lcol) + if (grepl("^#", lcol)) lcol <- sub("^#", "c", lcol) + rec$line_color[idx] <- lcol } if (!is.na(sty$line_width[row])) {