Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,22 @@ export function getShapeFill(node, isSvgMode, warpObj) {
if (fillColor) {
fillColor = `#${fillColor}`

// 检查透明度
const alpha = parseInt(getTextByPathList(node, ['p:spPr', 'a:solidFill', 'a:srgbClr', 'a:alpha', 'attrs', 'val'])) / 100000
if (!isNaN(alpha)) {
const color = tinycolor(fillColor)
color.setAlpha(alpha)
return color.toHex8String()
}

// 检查方案颜色的透明度
const schemeAlpha = parseInt(getTextByPathList(node, ['p:spPr', 'a:solidFill', 'a:schemeClr', 'a:alpha', 'attrs', 'val'])) / 100000
if (!isNaN(schemeAlpha)) {
const color = tinycolor(fillColor)
color.setAlpha(schemeAlpha)
return color.toHex8String()
}

let lumMod = parseInt(getTextByPathList(node, ['p:spPr', 'a:solidFill', 'a:schemeClr', 'a:lumMod', 'attrs', 'val'])) / 100000
let lumOff = parseInt(getTextByPathList(node, ['p:spPr', 'a:solidFill', 'a:schemeClr', 'a:lumOff', 'attrs', 'val'])) / 100000
if (isNaN(lumMod)) lumMod = 1.0
Expand Down