table_background_color: Set the table background color

View source: R/properties-table.R

table_background_colorR Documentation

Set the table background color

Description

table_background_color() sets a background color for the whole table. Individual background_color() values override the table background.

Usage

table_background_color(ht)

table_background_color(ht) <- value

set_table_background_color(ht, value)

Arguments

ht

A huxtable.

value

A string or NA. Set to NA to reset to the default, which is NA_character_.

Details

Colors can be specified as described in background_color(). The default, NA, leaves the table background unset.

Output formats handle table backgrounds differently:

  • HTML applies the color to the ⁠<table>⁠ element.

  • LaTeX wraps non-breakable tables in a zero-padding ⁠\colorbox⁠. Breakable LaTeX tables ignore the property because a longtable cannot be placed inside a ⁠\colorbox⁠.

  • Typst uses the table's fill setting. Individual cell fills override it.

  • RTF, Excel, Word and PowerPoint output apply the table color to cells which do not have an individual background color.

  • On-screen output applies the color to the whole table area, including borders. Individual cell backgrounds still override it.

  • Markdown output ignores the property.

Value

property() returns the property value(s). set_property() and map_property() return the modified huxtable.

See Also

Other formatting functions: background_color(), bold(), font(), font_size(), na_string(), number_format(), text_color()

Examples

set_table_background_color(jams, "grey95")


huxtable documentation built on Sept. 21, 2026, 1:07 a.m.