huxtable (version 0.2.2)

text_color: Text color

Description

Functions to get or set the text color property of huxtable table cells.

Usage

text_color(ht)
text_color(ht) <- value
set_text_color(ht, row, col, value, byrow = FALSE)

Arguments

ht
A huxtable.
value
A vector or matrix of R colors. Set to NA to reset to the default.
row
A row specifier. See rowspecs for details.
col
An optional column specifier.
byrow
If TRUE, fill in values by row rather than by column.

Value

For text_color, the text_color attribute. For set_text_color, the ht object.

See Also

Other formatting functions: background_color, bold, font_size, font, na_string, number_format

Examples

Run this code

ht <- huxtable(a = 1:3, b = 1:3)
text_color(ht) <-  'navy'
text_color(ht)


ht <- huxtable(a = 1:3, b = 3:1)
ht2 <- set_text_color(ht, 'navy')
text_color(ht2)
ht3 <- set_text_color(ht, 1:2, 1, 'navy')
text_color(ht3)
ht4 <- set_text_color(ht, 1:2, 1:2, c('navy', 'red'), byrow = TRUE)
text_color(ht4)
ht5 <- set_text_color(ht, where(ht == 1), 'navy')
text_color(ht5)

Run the code above in your browser using DataCamp Workspace