Colors can be in any format understood by R:
A color name like "darkred"
A HTML string like "#FF0000"
The result of a function like rgb(1, 0, 0)
or grey(0.5)
background_color(ht) background_color(ht) <- value set_background_color(ht, row, col, value ) map_background_color(ht, row, col, fn)
ht | A huxtable. |
---|---|
row | A row specifier. See rowspecs for details. |
col | An optional column specifier. |
fn | A mapping function. See mapping-functions for details. |
value | A character vector or matrix. Set to |
background_color()
returns the background_color
property.
set_background_color()
returns the modified huxtable.
Transparent colors are not guaranteed to work at present.
Other formatting functions:
bold()
,
font_size()
,
font()
,
na_string()
,
number_format()
,
text_color()
#> Type Price Sugar #> 1 "#B3B3B3" "#B3B3B3" "#B3B3B3" #> 1.1 "#B3B3B3" "#B3B3B3" "#B3B3B3" #> 2 "#B3B3B3" "#B3B3B3" "#B3B3B3" #> 3 "#B3B3B3" "#B3B3B3" "#B3B3B3"set_background_color(jams, "yellow")#> Type Price Sugar content #> Strawberry 1.90 40.00% #> Raspberry 2.10 35.00% #> Plum 1.80 50.00% #> #> Column names: Type, Price, Sugarset_background_color(jams, 2:3, 1, "yellow")#> Type Price Sugar content #> Strawberry 1.90 40.00% #> Raspberry 2.10 35.00% #> Plum 1.80 50.00% #> #> Column names: Type, Price, Sugar#> Type Price Sugar content #> Strawberry 1.90 40.00% #> Raspberry 2.10 35.00% #> Plum 1.80 50.00% #> #> Column names: Type, Price, Sugar