CSS style builder

Usage

style <- Style$new()
style <- css_style()

style$set_selector(".thing")
style$remove("color")
style$update(color = 'blue')
style$as_character()
style$as_inline()
new_style <- style$copy()

Methods

$update(..., selector = NULL)

Updates the list of properties associated with this style.

...name/value properties
selectorIf given, then used as the the selector for this style. If not given, then the first unnamed argument in ... is interpreted as the character string for the selector.

$set_selector(selector)

Updates the selector associated with this style.

selectornew selector. either a character string or a Selector object

$remove(...)

Removes properties from this style by name

...names of properties to remove (character strings)

$as_character()

Convert Style to a character string.

$as_inline()

Convert Style to a single character string without the selector, suitable for use as an inline style.

$print()

Print Style to terminal.

$copy()

Copy Style.

Examples

if (FALSE) { css_style('#marsha')$ update(marsha = 'marsha')$ update(ptag$display$none, width = "100%") }