HotXLS Docs

SetThemeColor method (Font)

Sets the font colour to one of the 12 Office theme colour slots with an optional tint adjustment. Theme companion of Font.Colour — use it when the application wants to follow the workbook theme palette instead of pinning a literal RGB. Available since v2.61.0 (chart backlog wave D phase 4).

Syntax

procedure SetThemeColor(ThemeIdx: Word; Tint: Double);

Parameters

ThemeIdx — 0-based theme slot (0=lt1, 1=dk1, 2=lt2, 3=dk2, 4..9=accent1..6, 10=hlink, 11=foHlink).
Tint — spec-style lighter/darker adjustment in the range -1.0 .. +1.0. Encoded into the XFExt FullColorExt as a Q15 signed integer in nTintShade.

Remarks

The setter behaves identically to Interior.SetThemeColor, but writes the rsFont slot of the XFExt $087D extType ($000D). The Font XF entry still receives a best-match indexed icv so Excel 97-2003 sees an approximation; Excel 2007+ recovers the exact theme idx + tint from the XFExt FullColorExt slot.
Reading back via Font.Colour returns the RGB resolved through the workbook's BIFF theme palette, so the application always sees a concrete LongWord regardless of whether the original setter was RGB or theme based.

Example

Tags an audit column with accent3 + tint so the font colour tracks the workbook theme.

Workbook.Sheets[1].Range['D2', 'D50'].Font.SetThemeColor(6, - 0.25);
Workbook.SaveAs('AuditColumn.xls', xlExcel97);

See also