Feature Request: Expose Theme Color RGB Values in Office.js API
Title
Add API to retrieve resolved RGB/hex values for workbook theme colors
Summary
The Office.js API currently does not provide a method to retrieve the actual RGB or hex color values for theme colors applied in a workbook. When chart elements, shapes, or cells use theme-based fills (e.g., "Accent 1", "Accent 2"), developers can identify the theme color type but cannot programmatically resolve it to the actual color value.
Problem Statement
When automating chart formatting tasks, I need to:
- Read the current fill color of a chart point (which uses theme colors)
- Apply that same color to other points in the series
Current behavior: point.format.fill.getSolidColor() fails or returns undefined for theme-based colors. The API only exposes the abstract theme reference, not the resolved RGB value.
Impact: This prevents common automation scenarios such as:
- Uniformly formatting chart data points across historical vs. forecast periods
- Copying formatting between elements that use theme colors
- Maintaining brand consistency when programmatically generating charts
- Migrating or syncing formatting between workbooks with different themes
Proposed Solution
Add methods to expose resolved theme colors:
// Option 1: Query the theme directly const color = await context.workbook.theme.getColor("Accent1"); // Returns: "#4472C4" // Option 2: Resolve fill color regardless of source const resolvedColor = await point.format.fill.getResolvedColor(); // Returns: "#4472C4" (works for theme, solid, or automatic fills) // Option 3: Get full theme palette const palette = await context.workbook.theme.getColorPalette(); // Returns: { accent1: "#4472C4", accent2: "#ED7D31", ... }
Business Justification
- Essential for enterprise automation of branded reports and dashboards
- Enables consistent formatting across programmatically generated charts
- Reduces manual formatting work for recurring financial/business reports
Affected API Area
- Excel.ChartPoint.format.fill
- Excel.ChartSeries.format.fill
- Excel.Workbook (new theme property)