MCPcopy Index your code
hub / github.com/simstudioai/sim / buildChartPalette

Function buildChartPalette

apps/sim/lib/pptx-renderer/renderer/chart-renderer.ts:2542–2557  ·  view source on GitHub ↗

* Build a chart color palette from theme accents and chart style id. * This improves parity with Office chart styles when series colors are implicit.

(chartXml: SafeXmlNode, ctx: RenderContext)

Source from the content-addressed store, hash-verified

2540 * This improves parity with Office chart styles when series colors are implicit.
2541 */
2542function buildChartPalette(chartXml: SafeXmlNode, ctx: RenderContext): string[] | undefined {
2543 const accents = ['accent1', 'accent2', 'accent3', 'accent4', 'accent5', 'accent6']
2544 .map((k) => ctx.theme.colorScheme.get(k))
2545 .filter((v): v is string => !!v)
2546 .map((hex) => (hex.startsWith('#') ? hex : `#${hex}`))
2547
2548 if (accents.length === 0) return undefined
2549
2550 const styleId = parseChartStyleId(chartXml)
2551 if (styleId === undefined) return accents
2552
2553 // Style ids 100+ use the same accent order as the base palette.
2554 // No rotation needed — OOXML chart styles control visual appearance
2555 // (e.g. 3D, transparency) but don't reorder series colors.
2556 return accents
2557}
2558
2559// ---------------------------------------------------------------------------
2560// Chart-Space Default Font Size + Legend Grid Adjustment

Callers 1

parseChartXmlFunction · 0.85

Calls 2

parseChartStyleIdFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected