function applyColorTransforms(rgba: RGBA, transforms: ColorTransform[]): RGBA;Given a set of RGBA colors, apply a list of color transformations on them and return the result. Note that the toRGBA function does this automatically.
| Parameter | Type | Description |
|---|---|---|
rgba |
RGBA |
The base RGBA color to use. |
transforms |
ColorTransform[] |
A list of ColorTransform objects to apply. |
A transformed RGBA color.
function emuToPx(emu: number): number;Convert a number from EMU (English Metric Units) to pixels, assuming the Excel default of 72 DPI. Refer to the JSF spec for documentation on the EMU.
| Parameter | Type | Description |
|---|---|---|
emu |
number |
An EMU size that should be converted to pixels. |
number
The same measure computed to pixels.
function getPatternData(
patternName: PatternStyle | FillPatternStyle,
patternColor: RGBA | RGB,
fillColor: RGBA | RGB): Uint8ClampedArray;Return a 256 byte Uint8ClampedArray corresponding to an 8x8 pattern (of 4 bytes per pixel). This can then be used in an ImageData interface to paint the pattern on a canvas.
| Parameter | Type | Description |
|---|---|---|
patternName |
PatternStyle | FillPatternStyle |
The name of the pattern. |
patternColor |
RGBA | RGB |
The color for the pattern foreground fill. |
fillColor |
RGBA | RGB |
The color for the pattern background fill. |
Uint8ClampedArray
The pattern as a 256 byte Uint8ClampedArray.
function parseRGBA(value?: string): RGBA;Parse a hex color string into an RGBA channel set.
| Parameter | Type | Description |
|---|---|---|
value? |
string |
The string to parse. |
A list of the R, G, B, and A channels.
function pxToEmu(px: number): number;Convert a number from pixels to EMU (English Metric Units), assuming the Excel default of 72 DPI. Refer to the JSF spec for documentation on the EMU.
| Parameter | Type | Description |
|---|---|---|
px |
number |
A pixel size that should be converted to EMU. |
number
The same size computed to EMU.
function rgbToString(rgba: RGBA | RGB): string;Stringify RGB or RGBA values into a hex color string without a hash prefix.
The output will always be a 6 digit string regardless of the alpha channel value.
| Parameter | Type | Description |
|---|---|---|
rgba |
RGBA | RGB |
The RGBA or RGB values to render. |
string
A 6 digit hex color string (FFC823).
function rgbaToString(rgba: RGBA | RGB): string;Stringify RGBA values into a hex color string without a hash prefix.
The output will always be an 8 digit string regardless of the alpha
channel value. The channel order is web-style: RRGGBBAA
| Parameter | Type | Description |
|---|---|---|
rgba |
RGBA | RGB |
The RGBA values to render. |
string
An 8 digit hex color string (FFC823FF).
function toRGBA(
color: Color,
themeColors?: ThemeColorScheme,
indexedColors?: readonly string[]): RGBA;Resolves a JSF Color object to an RGBA tuple.
| Parameter | Type | Default value | Description |
|---|---|---|---|
color |
Color |
undefined |
A JSF Color object. |
themeColors? |
ThemeColorScheme |
DEFAULT_THEME_COLOR_SCHEME |
A JSF ThemeColorScheme used to resolve Schema colors. |
indexedColors? |
readonly string[] |
INDEXED_COLORS |
A list of 6-digit hex codes to use to |
type RGB = [number, number, number];A set of numbers representing R, G, and B, color channels respectively. The color is assumed to use the sRGB colorspace.
All values range from 0 to 255.
type RGBA = [number, number, number, number];A set of numbers representing R, G, B, and A, color channels respectively. The color is assumed to use the sRGB colorspace.
R, G, and B values range from 0 to 255. A ranges from 0 to 1.
const DEFAULT_THEME_COLOR_SCHEME: Readonly<ThemeColorScheme>;The current default Office theme color scheme.
const INDEXED_COLORS: readonly string[];OOXML indexed color palette (indices 0–63, plus 64/65 for system foreground/background). The values are all 6-digit sRGB hex strings.
const PRESET_COLORS: Readonly<Record<string, string>>;OOXML preset color names mapped to 6-digit sRGB hex strings.
These are the colors defined in ECMA-376 Part 1, section 20.1.10.47 (ST_PresetColorVal).
const SYSTEM_COLORS: Readonly<Record<string, string>>;Default RGB hex values for Windows system colors, used when resolving system Color values.
The values are all 6-digit sRGB hex strings.
The values here are typical Windows defaults and match those produced by Excel.
const THEMES: Record<string, Readonly<Theme>>;A lookup of default Office theme definitions keyed by Excel build number.
Each entry corresponds to the default theme that shipped with a specific
version of Excel. The "default" key always points to the current
(most recent) theme.