File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,21 @@ export async function nodeToSvg(node, config) {
139139 svg . appendChild ( rectClone )
140140
141141 }
142- svg . appendChild ( rect )
142+ // if the rect color is transparent, we remove the rect
143+ let isTransparent = false
144+ if ( rectStyle . backgroundColor === "transparent" ) {
145+ isTransparent
146+ }
147+ if ( rectStyle . backgroundColor . startsWith ( 'rgba' ) ) {
148+ const colorParts = rectStyle . backgroundColor . split ( ',' )
149+ const alphaPart = colorParts [ 3 ] . replace ( ')' , '' ) . trim ( )
150+ if ( alphaPart === '0' ) {
151+ isTransparent = true
152+ }
153+ }
154+ if ( ! isTransparent ) {
155+ svg . appendChild ( rect )
156+ }
143157 //console.log(rect)
144158 } else if ( currentNode . tagName === "svg" ) {
145159 const svgElement = currentNode . cloneNode ( true )
You can’t perform that action at this time.
0 commit comments