gt (version 0.1.0)

cells_styles: Helper for defining custom styles for table cells

Description

This helper function is to be used with the tab_style() function, which itself allows for the setting of custom styles to one or more cells. We can also define several styles within a single call of cells_styles() and tab_style() will reliably apply those styles to the targeted element.

Usage

cells_styles(
  bkgd_color = NULL,
  text_color = NULL,
  text_font = NULL,
  text_size = NULL,
  text_align = NULL,
  text_style = NULL,
  text_weight = NULL,
  text_stretch = NULL,
  text_indent = NULL,
  text_decorate = NULL,
  text_transform = NULL
)

Arguments

bkgd_color

The background color of the cell.

text_color

The text color.

text_font

The font or collection of fonts (subsequent font names are) used as fallbacks.

text_size

The size of the font. Can be provided as a number that is assumed to represent px values (or could be wrapped in the px()) helper function. We can also use one of the following absolute size keywords: "xx-small", "x-small", "small", "medium", "large", "x-large", or "xx-large".

text_align

The text alignment. Can be one of either "center", "left", "right", or "justify".

text_style

The text style. Can be one of either "center", "normal", "italic", or "oblique".

text_weight

The weight of the font. Can be a text-based keyword such as "normal", "bold", "lighter", "bolder", or, a numeric value between 1 and 1000, inclusive. Note that only variable fonts may support the numeric mapping of weight.

text_stretch

Allows for text to either be condensed or expanded. We can use the following text-based keywords to describe the degree of condensation/expansion: "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", and "ultra-expanded". Alternatively, we can supply percentage values from 0\% to 200\%, inclusive. Negative percentage values are not allowed.

text_indent

The indentation of the text.

text_decorate

Allows for text decoration effect to be applied. Here, we can use "overline", "line-through", or "underline".

text_transform

Allows for the transformation of text. Options are "uppercase", "lowercase", or "capitalize".

Value

A character vector containing formatted styles.

Details

This function is now soft-deprecated, which means it will soon be removed. Please consider using the cell_fill() (where bkgd_color is color) and cell_text() (contains all other arguments here without the leading text_).

See Also

Other helper functions: cell_borders(), cell_fill(), cell_text(), escape_latex(), gt_latex_dependencies(), html(), md(), pct(), px(), random_id()