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

Function parseTheme

apps/sim/lib/pptx-renderer/model/theme.ts:63–95  ·  view source on GitHub ↗
(root: SafeXmlNode)

Source from the content-addressed store, hash-verified

61 * Parse a theme XML root (`a:theme`) into ThemeData.
62 */
63export function parseTheme(root: SafeXmlNode): ThemeData {
64 const themeElements = root.child('themeElements')
65
66 // --- Color scheme ---
67 const clrScheme = themeElements.child('clrScheme')
68 const colorScheme = new Map<string, string>()
69
70 for (const slot of COLOR_SLOTS) {
71 const slotNode = clrScheme.child(slot)
72 if (slotNode.exists()) {
73 const hex = extractColor(slotNode)
74 if (hex !== undefined) {
75 colorScheme.set(slot, hex)
76 }
77 }
78 }
79
80 // --- Font scheme ---
81 const fontScheme = themeElements.child('fontScheme')
82 const majorFont = parseFontInfo(fontScheme.child('majorFont'))
83 const minorFont = parseFontInfo(fontScheme.child('minorFont'))
84
85 // --- Format scheme ---
86 const fmtScheme = themeElements.child('fmtScheme')
87 const fillStyleLst = fmtScheme.child('fillStyleLst')
88 const fillStyles: SafeXmlNode[] = fillStyleLst.allChildren()
89 const lnStyleLst = fmtScheme.child('lnStyleLst')
90 const lineStyles: SafeXmlNode[] = lnStyleLst.allChildren()
91 const effectStyleLst = fmtScheme.child('effectStyleLst')
92 const effectStyles: SafeXmlNode[] = effectStyleLst.allChildren()
93
94 return { colorScheme, majorFont, minorFont, fillStyles, lineStyles, effectStyles }
95}

Callers 1

buildPresentationFunction · 0.90

Calls 6

extractColorFunction · 0.85
parseFontInfoFunction · 0.85
childMethod · 0.80
existsMethod · 0.80
allChildrenMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected