Skip to content

Commit f245cad

Browse files
committed
Transparent background
1 parent 8cd5628 commit f245cad

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
"description": "Shadow of the snippet node. Use any value for CSS `box-shadow`",
4747
"default": "rgba(0, 0, 0, 0.55) 0px 20px 68px"
4848
},
49-
"polacode.background": {
50-
"type": "string",
51-
"description": "Background of the container node. Use any value for CSS `background`",
52-
"default": "rgba(242, 242, 242, 1)"
49+
"polacode.transparentBackground": {
50+
"type": "boolean",
51+
"description": "Transparent background for containers",
52+
"default": false
5353
},
5454
"polacode.target": {
5555
"type": "string",

src/extension.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function activate(context) {
111111
panel.webview.postMessage({
112112
type: 'updateSettings',
113113
shadow: settings.get('shadow'),
114-
background: settings.get('background'),
114+
transparentBackground: settings.get('transparentBackground'),
115115
target: settings.get('target')
116116
})
117117
}

webview/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const vscode = acquireVsCodeApi()
33

44
let target = 'container'
5+
let transparentBackground = false
56

67
vscode.postMessage({
78
type: 'getAndUpdateCacheAndSettings'
@@ -141,7 +142,8 @@
141142
height,
142143
style: {
143144
transform: 'scale(2)',
144-
'transform-origin': 'center'
145+
'transform-origin': 'center',
146+
background: `rgba(242, 242, 242, ${transparentBackground ? 0 : 1})`
145147
}
146148
}
147149

@@ -236,7 +238,7 @@
236238
} else if (e.data.type === 'updateSettings') {
237239
snippet.style.boxShadow = e.data.shadow
238240
target = e.data.target
239-
snippetContainerNode.style.background = e.data.background
241+
transparentBackground = e.data.transparentBackground
240242
}
241243
}
242244
})

0 commit comments

Comments
 (0)