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)
text_color(ht)
text_color(ht) <- value
set_text_color(ht, row, col, value )
map_text_color(ht, row, col, fn)
A huxtable.
A row specifier. See rowspecs for details.
An optional column specifier.
A mapping function. See mapping-functions for details.
A character vector or matrix.
Set to NA
to reset to the default, which is "NA"
.
text_color()
returns the text_color
property.
set_text_color()
returns the modified huxtable.
Other formatting functions:
background_color()
,
bold()
,
font()
,
font_size()
,
na_string()
,
number_format()
text_color(jams) <- "blue"
text_color(jams)
#> Type Price
#> 1 "blue" "blue"
#> 1.1 "blue" "blue"
#> 2 "blue" "blue"
#> 3 "blue" "blue"
set_text_color(jams, "red")
#> Type Price
#> Strawberry 1.90
#> Raspberry 2.10
#> Plum 1.80
#>
#> Column names: Type, Price
set_text_color(jams,
2:3, 1, "red")
#> Type Price
#> Strawberry 1.90
#> Raspberry 2.10
#> Plum 1.80
#>
#> Column names: Type, Price
map_text_color(jams,
by_rows("red", "blue"))
#> Type Price
#> Strawberry 1.90
#> Raspberry 2.10
#> Plum 1.80
#>
#> Column names: Type, Price