# Styles API

Edition: Community and Commercial

Community (MIT, public PyPI) provides `Font`, `PatternFill`, `Alignment`, `Border`, `Side`, `Color`, and the font effect flags. `ThemePalette` and the rendered text-decoration behavior described below are part of the Commercial edition (authenticated package index, latest published release 2.3.0).

WolfXL exposes openpyxl-style styling classes and `ThemePalette`:

- `Font`
- `PatternFill`
- `Alignment`
- `Border`
- `Side`
- `Color`
- `ThemePalette`

## Example

```
from wolfxl import Font, PatternFill, Alignment, Border, Side

ws["A1"].font = Font(bold=True, name="Calibri", size=11)
ws["A1"].fill = PatternFill(patternType="solid", fgColor="FFF2CC")
ws["A1"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
ws["A1"].border = Border(left=Side(style="thin", color="000000"))
ws["A1"].number_format = "#,##0.00"
```

## Theme palettes

`ThemePalette.for_workbook(wb)` returns the workbook's editable OOXML color scheme. Update a known scheme name such as `"accent1"` and call `palette.apply_to(wb)` before saving; only the theme color scheme is updated. The `ThemePalette` and font-effect contracts here are source-qualified and do not assert installed-wheel availability or release adoption. See `smoke_parity_xl_cells_formatting_fidelity.py` for the verified public workflow.

## Notes

- Style writes are flushed on `wb.save()`.
- In modify mode, style changes are queued and applied during patch save.

## Underline & Text Decorations

WolfXL supports standard and accounting underline styles plus the OOXML font effect flags `outline`, `shadow`, `condense`, and `extend` on cell fonts and rich-text runs:

- `underline="single"`: Standard single underline drawn under rendered glyphs at the text baseline.
- `underline="double"`: Standard double underline drawn under rendered glyphs with double-line spacing.
- `underline="singleAccounting"`: Single accounting underline positioned near the bottom of the cell. For numeric cells, the underline spans the width of the formatted number aligned with the value; for text cells, it spans the full cell content width (minus cell insets).
- `underline="doubleAccounting"`: Double accounting underline positioned near the bottom of the cell with proportional double-line spacing based on font size. Follows the same numeric vs. text cell span rules.

### Multi-line & Wrapped Text

When `wrap_text=True` or explicit newlines (`\n`) are present in cell content:

- Underlines and strikethroughs are emitted per wrapped line using measured line widths and line baselines from the resolved font metrics.
- Standard underlines and strikethroughs follow the glyph extents for each individual line rather than aggregate cell bounding boxes.
- Decorations are clipped to cell padding boundaries to prevent visual bleed across cell borders.
