(spPr: SafeXmlNode, ctx: RenderContext)
| 218 | * - '' for blipFill (handled by ImageRenderer) or no fill found (inherit) |
| 219 | */ |
| 220 | export 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 |
no test coverage detected