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

Function renderBgRef

apps/sim/lib/pptx-renderer/renderer/background-renderer.ts:144–159  ·  view source on GitHub ↗

* Render background from bgRef (theme format scheme reference). * Simplified: just resolve the color from the reference.

(bgRef: SafeXmlNode, ctx: RenderContext, container: HTMLElement)

Source from the content-addressed store, hash-verified

142 * Simplified: just resolve the color from the reference.
143 */
144function renderBgRef(bgRef: SafeXmlNode, ctx: RenderContext, container: HTMLElement): void {
145 // bgRef may contain a color child (schemeClr, srgbClr, etc.)
146 if (!hasColorNode(bgRef)) {
147 container.style.backgroundColor = '#FFFFFF'
148 return
149 }
150
151 const { color, alpha } = resolveColor(bgRef, ctx)
152 const hex = color.startsWith('#') ? color : `#${color}`
153 if (alpha < 1) {
154 const { r, g, b } = hexToRgb(hex)
155 container.style.backgroundColor = compositeOnWhite(r, g, b, alpha)
156 } else {
157 container.style.backgroundColor = hex
158 }
159}
160
161/**
162 * Render a blip (image) fill as a CSS background.

Callers 1

renderBackgroundFunction · 0.85

Calls 4

resolveColorFunction · 0.90
hexToRgbFunction · 0.90
hasColorNodeFunction · 0.85
compositeOnWhiteFunction · 0.85

Tested by

no test coverage detected