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

Function resolveFill

apps/sim/lib/pptx-renderer/renderer/style-resolver.ts:220–264  ·  view source on GitHub ↗
(spPr: SafeXmlNode, ctx: RenderContext)

Source from the content-addressed store, hash-verified

218 * - '' for blipFill (handled by ImageRenderer) or no fill found (inherit)
219 */
220export function resolveFill(spPr: SafeXmlNode, ctx: RenderContext): string {
221 // solidFill
222 const solidFill = spPr.child('solidFill')
223 if (solidFill.exists()) {
224 const { color, alpha } = resolveColor(solidFill, ctx)
225 return toCssColor(color, alpha)
226 }
227
228 // gradFill
229 const gradFill = spPr.child('gradFill')
230 if (gradFill.exists()) {
231 return resolveGradient(gradFill, ctx)
232 }
233
234 // blipFill — handled externally by ImageRenderer
235 const blipFill = spPr.child('blipFill')
236 if (blipFill.exists()) {
237 return ''
238 }
239
240 // pattFill — pattern fill rendered as CSS repeating gradient
241 const pattFill = spPr.child('pattFill')
242 if (pattFill.exists()) {
243 return resolvePatternFill(pattFill, ctx)
244 }
245
246 // grpFill — inherit fill from parent group
247 const grpFill = spPr.child('grpFill')
248 if (grpFill.exists()) {
249 if (ctx.groupFillNode) {
250 return resolveFill(ctx.groupFillNode, ctx)
251 }
252 // No group fill context available — fall through to no fill
253 return ''
254 }
255
256 // noFill
257 const noFill = spPr.child('noFill')
258 if (noFill.exists()) {
259 return 'transparent'
260 }
261
262 // No fill found — inherit
263 return ''
264}
265
266// ---------------------------------------------------------------------------
267// Pattern Fill Resolution

Callers 2

renderShapeFunction · 0.90
renderBgPrFunction · 0.90

Calls 6

toCssColorFunction · 0.90
resolveGradientFunction · 0.85
resolvePatternFillFunction · 0.85
childMethod · 0.80
existsMethod · 0.80
resolveColorFunction · 0.70

Tested by

no test coverage detected