Header, zebra, borders, and footer text now use navy_700, paper_2, rule_strong, rule, and ink_3 instead of Bootstrap hex values. Tables built with the defaults change appearance. Closes #21 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
95 lines
3.1 KiB
R
95 lines
3.1 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/flextable.R
|
|
\name{style_flextable_civilytics}
|
|
\alias{style_flextable_civilytics}
|
|
\title{Apply the Civilytics brand styling to a flextable}
|
|
\usage{
|
|
style_flextable_civilytics(
|
|
ft,
|
|
header_bg = civilytics_colors[["navy_700"]],
|
|
header_color = "white",
|
|
title_fontsize = 14,
|
|
body_fontsize = 11,
|
|
font_name = "Arial",
|
|
zebra = TRUE,
|
|
zebra_bg = civilytics_colors[["paper_2"]],
|
|
outer_border_color = civilytics_colors[["rule_strong"]],
|
|
outer_border_width = 1,
|
|
inner_border_color = civilytics_colors[["rule"]],
|
|
inner_border_width = 0.5,
|
|
footer_fontsize = 9,
|
|
footer_color = civilytics_colors[["ink_3"]]
|
|
)
|
|
}
|
|
\arguments{
|
|
\item{ft}{A [flextable::flextable()] object.}
|
|
|
|
\item{header_bg}{Character. Header background fill. Default
|
|
`civilytics_colors[["navy_700"]]`.}
|
|
|
|
\item{header_color}{Character. Header text color. Default `"white"`.}
|
|
|
|
\item{title_fontsize}{Numeric. Font size for the first header line (the
|
|
title row, `i = 1`). Default `14`.}
|
|
|
|
\item{body_fontsize}{Numeric. Body font size. Default `11`.}
|
|
|
|
\item{font_name}{Character. Font family applied to all parts. Default
|
|
`"Arial"`.}
|
|
|
|
\item{zebra}{Logical. Apply alternating-row striping to even body rows.
|
|
Default `TRUE`. Safely skipped for tables with fewer than two body rows.}
|
|
|
|
\item{zebra_bg}{Character. Fill color for striped (even) body rows.
|
|
Default `civilytics_colors[["paper_2"]]`.}
|
|
|
|
\item{outer_border_color}{Character. Outer border color. Default
|
|
`civilytics_colors[["rule_strong"]]`.}
|
|
|
|
\item{outer_border_width}{Numeric. Outer border width. Default `1`.}
|
|
|
|
\item{inner_border_color}{Character. Inner horizontal border color (body).
|
|
Default `civilytics_colors[["rule"]]`.}
|
|
|
|
\item{inner_border_width}{Numeric. Inner horizontal border width. Default
|
|
`0.5`.}
|
|
|
|
\item{footer_fontsize}{Numeric. Footer font size (applied only if a footer
|
|
part exists). Default `9`.}
|
|
|
|
\item{footer_color}{Character. Footer text color. Default
|
|
`civilytics_colors[["ink_3"]]`.}
|
|
}
|
|
\value{
|
|
The styled [flextable::flextable()] object.
|
|
}
|
|
\description{
|
|
Applies *only* the visual Civilytics brand to an already-structured
|
|
[flextable::flextable()] — header fill and color, body font and size,
|
|
zebra striping, borders, footer styling, and a fixed table layout. The
|
|
caller remains responsible for table *structure*: labels
|
|
([flextable::set_header_labels()]), header/title lines
|
|
([flextable::add_header_lines()]), column widths ([flextable::width()]),
|
|
alignment ([flextable::align()]), and footer text
|
|
([flextable::add_footer_lines()]). This separation keeps styling reusable
|
|
across projects while leaving content decisions where they belong.
|
|
}
|
|
\details{
|
|
`flextable`, `officer`, and `ragg` are Suggested (not Imported) to keep the
|
|
base install light, so this function errors with an install hint if
|
|
`flextable` is unavailable.
|
|
}
|
|
\examples{
|
|
\dontrun{
|
|
library(flextable)
|
|
ft <- flextable(head(mtcars)) |>
|
|
add_header_lines("Motor Trend Cars") |>
|
|
add_footer_lines("Source: mtcars") |>
|
|
style_flextable_civilytics()
|
|
}
|
|
}
|
|
\seealso{
|
|
[save_branded_flextable_png()] to export the styled table to a
|
|
logo-stamped PNG.
|
|
}
|