The `TableStyle` class specifies the styling for headers and cells in a table. Styles are specified in the form of Cascading Style Sheet (CSS) name-value pairs.

Format

R6Class object.

Active bindings

name

The unique name of the style (must be unique among the style names in the table theme).

declarations

A list containing CSS style declarations. Example: `declarations = list(font="...", color="...")`

Methods

Public methods


Method new()

Create a new `TableStyle` object.

Usage

TableStyle$new(parentTable, styleName = NULL, declarations = NULL)

Arguments

parentTable

Owning table.

styleName

A unique name for the style.

declarations

A list containing CSS style declarations. Example: `declarations = list(font="...", color="...")`

Returns

No return value.


Method setPropertyValue()

Set the value of a single style property.

Usage

TableStyle$setPropertyValue(property = NULL, value = NULL)

Arguments

property

The CSS style property name, e.g. color.

value

The value of the style property, e.g. red.

Returns

No return value.


Method setPropertyValues()

Set the values of multiple style properties.

Usage

TableStyle$setPropertyValues(declarations = NULL)

Arguments

declarations

A list containing CSS style declarations. Example: `declarations = list(font="...", color="...")`

Returns

No return value.


Method getPropertyValue()

Get the value of a single style property.

Usage

TableStyle$getPropertyValue(property = NULL)

Arguments

property

The CSS style property name, e.g. color.

Returns

No return value.


Method asCSSRule()

Generate a CSS style rule from this table style.

Usage

TableStyle$asCSSRule(selector = NULL)

Arguments

selector

The CSS selector name. Default value `NULL`.

Returns

The CSS style rule, e.g. text-align: center; color: red;


Method asNamedCSSStyle()

Generate a named CSS style from this table style.

Usage

TableStyle$asNamedCSSStyle(styleNamePrefix = NULL)

Arguments

styleNamePrefix

A character variable specifying a prefix for all named CSS styles, to avoid style name collisions where multiple tables exist.

Returns

The CSS style rule, e.g. cell text-align: center; color: red;


Method getCopy()

Create a copy of this `TableStyle` object.

Usage

TableStyle$getCopy(newStyleName = NULL)

Arguments

newStyleName

The name of the new style.

Returns

The new `TableStyle` object.


Method asList()

Return the contents of this object as a list for debugging.

Usage

TableStyle$asList()

Returns

A list of various object properties.


Method asJSON()

Return the contents of this object as JSON for debugging.

Usage

TableStyle$asJSON()

Returns

A JSON representation of various object properties.


Method clone()

The objects of this class are cloneable with this method.

Usage

TableStyle$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# TableStyle objects are normally created indirectly via one of the helper # methods. # For an example, see the `TableStyles` class.