/** * Read-only resolution of SpreadsheetML `CT_Color` to `#RRGGBB`. * * Stored attributes (`auto`, `indexed`, `rgb`, `theme`, `tint`) are never * rewritten. `rgbColor` is a computed view and must not be serialized. * * Citations: * - ECMA-376-1 §18.3.1.15 `color` / `tint` (HLS, HLSMAX = 255) * - ECMA-376-1 §18.8.27 `indexedColors` (implied default palette) * - ECMA-376-1 §20.1.6.2 `clrScheme` (theme index order; `sysClr` / `srgbClr`) * - ECMA-376-1 §14.2.7 Theme Part (Strict relationship) * - ECMA-376-4 §12.2.7 Theme Part (Transitional relationship) */ /** * Theme scheme used to resolve `theme` indexes. Twelve `#RRGGBB` slots * (alpha omitted). Missing slots stay unresolved. */ export interface ThemeColorScheme { readonly colors: ReadonlyArray; } /** * Workbook color context for resolution. Indexed overrides replace the * implied §18.8.27 palette from index 0 when a `colors` collection is present. */ export interface ColorResolutionContext { readonly theme: ThemeColorScheme; readonly indexedRgb?: ReadonlyArray; } /** Stored SpreadsheetML color attributes (no computed view). */ export interface StoredColor { readonly auto?: boolean; readonly indexed?: number; readonly rgb?: string; readonly theme?: number; readonly tint?: number; } /** * Apply ECMA-376-1 §18.3.1.15 tint to an RGB triple. * `tint` 0 leaves the color unchanged. Out-of-range tint is clamped to [-1, 1]. */ export declare function applySpreadsheetTint(r: number, g: number, b: number, tint: number): { r: number; g: number; b: number; }; /** * §18.3.1.15 luminance step. Exported so tests can pin the spec examples * without OOXML. */ export declare function applyTintToLuminance(lum: number, tint: number): number; /** * Resolve a stored color to `#RRGGBB`, or `undefined` when automatic, * system-indexed, or otherwise unresolvable. Does not invent a color for * `auto`. */ export declare function resolveColorToRgb(color: StoredColor | undefined, context: ColorResolutionContext): string | undefined; /** * Parse a theme part for the first `clrScheme` twelve-color list. * `srgbClr@val` wins; otherwise `sysClr@lastClr`. Unreadable slots are * undefined (callers may fall back only when the whole part is absent). */ export declare function parseThemeColorScheme(themeXml: string): ThemeColorScheme; /** Office default scheme used only when no theme part is present. */ export declare function defaultThemeColorScheme(): ThemeColorScheme; /** * Parse `indexedColors` / `rgbColor@rgb` overrides (ECMA-376-1 §18.8.27). * Returns undefined when the collection is absent. */ export declare function parseIndexedColorOverrides(colorsCollectionXml: string | undefined): ReadonlyArray | undefined; /** `#RRGGBB` uppercase, no alpha. */ export declare function formatRgbHex(r: number, g: number, b: number): string;