ResolveIndexedColor method
Classifies an indexed color token and resolves a concrete ARGB value when the workbook palette or a caller-supplied system-color resolver provides one
The method is available on both IXLSWorkbook and TXLSXWorkbook and does not modify workbook state
Syntax
function ResolveIndexedColor( AIndex: Int64; ASpace: TXLSIndexedColorSpace; out AResolution: TXLSIndexedColorResolution): Boolean; overload; function ResolveIndexedColor( AIndex: Int64; ASpace: TXLSIndexedColorSpace; ARole: TXLSIndexedColorRole; ASystemResolver: TXLSTryResolveSystemColor; out AResolution: TXLSIndexedColorResolution): Boolean; overload;
Index spaces
| Space | Interpretation |
|---|---|
xicsPublicColorIndex | Public palette indexes 1..56 map to BIFF palette slots 8..63; signed or unsigned xlColorIndexAutomatic is classified as automatic |
xicsBiffIcv | BIFF indexes are validated against the selected role: font and comment colors use the IcvFont subset, border and fill colors use the IcvXF subset, chart colors use the IcvChart subset, and general lookup uses the complete Icv table |
xicsOoxmlIndexed | OOXML indexes 0..63 address the indexed palette, 64 and 65 identify system foreground and background, and larger values are invalid |
Result
| Field | Meaning |
|---|---|
Kind | xickPalette, xickAutomatic, xickSystem, or xickInvalid |
RawIndex | The unchanged input value |
PaletteSlot | The zero-based physical palette slot, or -1 when the token is not palette based |
SystemColorRole | The semantic system role, including window text, window background, chart text, chart background, chart neutral, or tooltip text |
ARGB | The normalized concrete color when HasResolvedColor is true |
HasResolvedColor | True only when palette lookup, a fixed format color, or the explicit callback produced an RGB value |
The function return value matches HasResolvedColor; classification remains available in AResolution when the function returns false
System-color contract
The short overload never reads the current Windows desktop and therefore leaves automatic and environment-dependent system colors unresolved
The long overload passes both TXLSSystemColorRole and TXLSIndexedColorRole to ASystemResolver, allowing the caller to apply an explicit UI, export, or headless rendering policy
The callback output must use $AARRGGBB channel order; a zero alpha byte is normalized to $FF, while a callback result of false leaves the semantic token classified but unresolved
A Windows COLORREF uses $00BBGGRR channel order and must be converted to $AARRGGBB before the callback returns it
Invalid tokens never invoke the callback, and the fixed BIFF chart-neutral token resolves to opaque black without a callback
Example
if Workbook.ResolveIndexedColor(12, xicsPublicColorIndex, Resolution) then UseArgb(Resolution.ARGB); if not Workbook.ResolveIndexedColor($40, xicsBiffIcv, Resolution) then Assert(Resolution.Kind = xickSystem);