* Render background from bgRef (theme format scheme reference). * Simplified: just resolve the color from the reference.
(bgRef: SafeXmlNode, ctx: RenderContext, container: HTMLElement)
| 142 | * Simplified: just resolve the color from the reference. |
| 143 | */ |
| 144 | function 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. |
no test coverage detected