/** * Colour reference. All fields are optional but Excel expects exactly one of * {rgb, indexed, theme, auto} to be set; if none is, the cell inherits the * parent style's colour. * * `tint` modulates the resolved colour; -1 = full black, +1 = full white. */ export interface Color { /** "AARRGGBB" hex (uppercase). 6-hex inputs are auto-padded with `00` alpha. */ readonly rgb?: string; /** 0..63 → COLOR_INDEX entry. 64 = system foreground, 65 = system background. */ readonly indexed?: number; /** Theme colour index. */ readonly theme?: number; /** "Auto" / system default. */ readonly auto?: boolean; /** Lightness modulation in [-1, 1]. */ readonly tint?: number; } /** * Legacy 64-entry palette indexed colours fall back to. Verbatim from * openpyxl/openpyxl/styles/colors.py — must not be reordered. */ export declare const COLOR_INDEX: readonly string[]; /** * Convenience constants — match openpyxl's exports. Inlined rather than indexed * off COLOR_INDEX to keep the type system from widening to `string | undefined` * on tuple lookup. */ export declare const BLACK = "00000000"; export declare const WHITE = "00FFFFFF"; export declare const BLUE = "000000FF"; /** * Normalise an aRGB hex string. Accepts either 6 or 8 hex digits; 6-digit input * is padded to 8 by prefixing `00` (alpha=0 = fully opaque per Excel * convention). Returns the canonical uppercase form. */ export declare function normaliseRgb(value: string): string; /** * Build an immutable {@link Color}. Validates ranges (indexed in [0, 65], tint * in [-1, 1]) and normalises rgb hex. */ export declare function makeColor(opts?: Partial): Color; /** * Resolve `indexed` references against {@link COLOR_INDEX}. Returns undefined * for 64/65 (system fg/bg, not in the palette) or out-of-range. */ export declare function resolveIndexedColor(idx: number): string | undefined; /** Shortcut for the common opaque solid colour. */ export declare function rgbColor(hex: string): Color; /** * Read a {@link Color} value-object back to a normalised ARGB hex. Resolution * order: explicit `rgb` → `indexed` palette lookup. Returns `undefined` for * `theme` / `auto` / empty inputs (unresolvable without a theme), so callers * can fall back to a default. */ export declare function colorToHex(color: Color | undefined): string | undefined; /** * Compute the relative luminance of an ARGB / RGB hex string per the WCAG 2.x * formula. Returns a value in `[0, 1]` where 0 is black and 1 is white. The * alpha channel (if present) is ignored. */ export declare function luminance(hex: string): number; /** * WCAG contrast ratio between two ARGB hex colors. Returns a value in `[1, * 21]`; 1 = identical luminance, 21 = pure black on pure white. The order of * arguments doesn't matter. */ export declare function contrastRatio(hexA: string, hexB: string): number; /** * Pick the higher-contrast text color (`'FF000000'` black or `'FFFFFFFF'` * white) for a background hex. Useful when applying a solid fill and wanting * the cell text to stay readable. */ export declare function pickReadableTextColor(backgroundHex: string): 'FF000000' | 'FFFFFFFF'; /** * Lighten a color by mixing it with white. `amount` is in `[0, 1]`: 0 returns * the input unchanged, 1 returns pure white. Alpha channel is preserved. * Equivalent to `mixColors(hex, 'FFFFFFFF', amount)`. */ export declare function lighten(hex: string, amount: number): string; /** * Darken a color by mixing it with black. `amount` is in `[0, 1]`: 0 returns * the input unchanged, 1 returns pure black (preserving the alpha channel). */ export declare function darken(hex: string, amount: number): string; /** * Linearly interpolate between two ARGB colors. `t = 0` returns `hexA`; `t = 1` * returns `hexB`; intermediate values mix per channel (including alpha). */ export declare function mixColors(hexA: string, hexB: string, t: number): string; /** * Convert an ARGB / RGB hex to its HSL representation. Returns `{ h, s, l, a }` * with `h ∈ [0, 360)`, `s ∈ [0, 1]`, `l ∈ [0, 1]`, `a ∈ [0, 255]` (alpha as the * original byte). Useful for theme tweaking (rotate hue, desaturate, etc.) * before round-tripping through {@link hslToHex}. */ export declare function hexToHsl(hex: string): { h: number; s: number; l: number; a: number; }; /** * Rotate the hue of a color by `degrees` (positive = clockwise). Saturation and * lightness are preserved; alpha is preserved. Equivalent to `hexToHsl` → * adjust `h` → `hslToHex`. */ export declare function rotateHue(hex: string, degrees: number): string; /** * Adjust the saturation of a color by `delta` (added directly to the `[0, 1]` * saturation channel and clamped). Positive = more vivid, negative = closer to * gray. Hue, lightness, and alpha are preserved. */ export declare function adjustSaturation(hex: string, delta: number): string; /** * Adjust the lightness of a color by `delta` (added directly to the `[0, 1]` * lightness channel and clamped). Positive = lighter, negative = darker. * Distinct from {@link lighten} / {@link darken} which mix toward white/black * in RGB space. */ export declare function adjustLightness(hex: string, delta: number): string; /** * Convert HSL components back to an ARGB hex string. `h` wraps mod-360, `s` and * `l` clamp to `[0, 1]`. `alpha` is the byte (default 255 = opaque), placed in * the high byte of the result. */ export declare function hslToHex(h: number, s: number, l: number, alpha?: number): string;