R/alter_flextable.R

Defines functions color_header color_rows

#' Color Rows
#'
#' If 'rows' is left as NULL all rows will have the color and bg applied.
#' 
#' @param flex flextable
#' @param rows numeric
#'
#' @return flextable
#' @export
#'
#'
color_rows <- function(flex, rows = NULL, bg = "light grey", color = "black") {
  flex <- bg(flex, i = rows, bg = bg)
  flex <- color(flex, i = rows, color = color)
  flex
}

#' Color Header
#'
#' If 'rows' is left as NULL all rows will have the color and bg applied.
#' 
#' @param flex flextable
#' @param rows numeric
#'
#' @return flextable
#' @export
#'
#'
color_header <- function(flex, rows = NULL, bg = "#ED7D31", color = "#FFFFFF") {
  flex <- bg(flex, i = rows, bg = bg, part = "header")
  flex <- color(flex, i = rows, color = color, part = "header")
  flex
}
cadenceinc/FlextableExtended documentation built on May 28, 2020, 12:49 a.m.