Skip to contents

Generic function to add or update style definitions. Dispatches to class-specific methods, allowing different spec classes to implement their own style handling.

Usage

add_style(spec, id, ...)

Arguments

spec

Spec object (dispatches on class)

id

Style identifier (auto-generated if NULL)

...

Style modifiers created with s_* functions

Value

Updated spec object

Details

Define styling for various document elements. Multiple calls to the same modifier function will merge with last-win strategy.

Available modifiers inside this function:

Examples

if (FALSE) { # \dontrun{
spec <- create_text() |>
  add_style(id = "header",
    s_font(font_name = "Arial", font_size = "14pt", bold = TRUE),
    s_paragraph(alignment = "center"),
    s_table_style(background_color = "#D9D9D9")
  ) |>
  # Multiple calls merge with last-win
  add_style(id = "header",
    s_font(color = "#FF0000")  # Adds color, keeps other font properties
  )
} # }