pptxtojson 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptxtojson",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A javascript tool for parsing .pptx file",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
package/src/fill.js CHANGED
@@ -95,7 +95,7 @@ export function getBgGradientFill(bgPr, phClr, slideMasterContent, warpObj) {
95
95
 
96
96
  color_ary[i] = {
97
97
  pos: pos ? (pos / 1000 + '%') : '',
98
- color: `#${lo_color}`,
98
+ color: lo_color,
99
99
  }
100
100
  }
101
101
  const lin = grdFill['a:lin']
@@ -110,7 +110,9 @@ export function getBgGradientFill(bgPr, phClr, slideMasterContent, warpObj) {
110
110
  colors: color_ary.sort((a, b) => parseInt(a.pos) - parseInt(b.pos)),
111
111
  }
112
112
  }
113
- else if (phClr) return `#${phClr}`
113
+ else if (phClr) {
114
+ return phClr.indexOf('#') === -1 ? `#${phClr}` : phClr
115
+ }
114
116
  return null
115
117
  }
116
118
 
@@ -139,7 +141,7 @@ export async function getSlideBackgroundFill(warpObj) {
139
141
  else clrMapOvr = getTextByPathList(slideMasterContent, ['p:sldMaster', 'p:clrMap', 'attrs'])
140
142
  }
141
143
  const sldBgClr = getSolidFill(sldFill, clrMapOvr, undefined, warpObj)
142
- background = `#${sldBgClr}`
144
+ background = sldBgClr
143
145
  }
144
146
  else if (bgFillTyp === 'GRADIENT_FILL') {
145
147
  const gradientFill = getBgGradientFill(bgPr, undefined, slideMasterContent, warpObj)
@@ -208,7 +210,7 @@ export async function getSlideBackgroundFill(warpObj) {
208
210
  if (bgFillTyp === 'SOLID_FILL') {
209
211
  const sldFill = bgFillLstIdx['a:solidFill']
210
212
  const sldBgClr = getSolidFill(sldFill, clrMapOvr, undefined, warpObj)
211
- background = `#${sldBgClr}`
213
+ background = sldBgClr
212
214
  }
213
215
  else if (bgFillTyp === 'GRADIENT_FILL') {
214
216
  const gradientFill = getBgGradientFill(bgFillLstIdx, phClr, slideMasterContent, warpObj)
@@ -236,7 +238,7 @@ export async function getSlideBackgroundFill(warpObj) {
236
238
  if (bgFillTyp === 'SOLID_FILL') {
237
239
  const sldFill = bgPr['a:solidFill']
238
240
  const sldBgClr = getSolidFill(sldFill, clrMapOvr, undefined, warpObj)
239
- background = `#${sldBgClr}`
241
+ background = sldBgClr
240
242
  }
241
243
  else if (bgFillTyp === 'GRADIENT_FILL') {
242
244
  const gradientFill = getBgGradientFill(bgPr, undefined, slideMasterContent, warpObj)
@@ -297,7 +299,7 @@ export async function getSlideBackgroundFill(warpObj) {
297
299
  if (bgFillTyp === 'SOLID_FILL') {
298
300
  const sldFill = bgFillLstIdx['a:solidFill']
299
301
  const sldBgClr = getSolidFill(sldFill, clrMapOvr, undefined, warpObj)
300
- background = `#${sldBgClr}`
302
+ background = sldBgClr
301
303
  }
302
304
  else if (bgFillTyp === 'GRADIENT_FILL') {
303
305
  const gradientFill = getBgGradientFill(bgFillLstIdx, phClr, slideMasterContent, warpObj)
@@ -325,7 +327,7 @@ export async function getSlideBackgroundFill(warpObj) {
325
327
  if (bgFillTyp === 'SOLID_FILL') {
326
328
  const sldFill = bgPr['a:solidFill']
327
329
  const sldBgClr = getSolidFill(sldFill, clrMap, undefined, warpObj)
328
- background = `#${sldBgClr}`
330
+ background = sldBgClr
329
331
  }
330
332
  else if (bgFillTyp === 'GRADIENT_FILL') {
331
333
  const gradientFill = getBgGradientFill(bgPr, undefined, slideMasterContent, warpObj)
@@ -386,7 +388,7 @@ export async function getSlideBackgroundFill(warpObj) {
386
388
  if (bgFillTyp === 'SOLID_FILL') {
387
389
  const sldFill = bgFillLstIdx['a:solidFill']
388
390
  const sldBgClr = getSolidFill(sldFill, clrMapOvr, undefined, warpObj)
389
- background = `#${sldBgClr}`
391
+ background = sldBgClr
390
392
  }
391
393
  else if (bgFillTyp === 'GRADIENT_FILL') {
392
394
  const gradientFill = getBgGradientFill(bgFillLstIdx, phClr, slideMasterContent, warpObj)
@@ -462,7 +464,7 @@ export function getSolidFill(solidFill, clrMap, phClr, warpObj) {
462
464
  else if (solidFill['a:schemeClr']) {
463
465
  clrNode = solidFill['a:schemeClr']
464
466
  const schemeClr = 'a:' + getTextByPathList(clrNode, ['attrs', 'val'])
465
- color = getSchemeColorFromTheme(schemeClr, warpObj, clrMap, phClr) || '#ffffffff'
467
+ color = getSchemeColorFromTheme(schemeClr, warpObj, clrMap, phClr) || '#ffffff'
466
468
  }
467
469
  else if (solidFill['a:scrgbClr']) {
468
470
  clrNode = solidFill['a:scrgbClr']