diff --git a/package.json b/package.json index 5f63377..85caa82 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,12 @@ "default": "#abb8c3", "description": "The background color of the snippet's container" }, + "codesnap.background": { + "scope": "resource", + "type": "string", + "default": "transparent", + "description": "The background of the snippet's container" + }, "codesnap.boxShadow": { "scope": "resource", "type": "string", @@ -148,4 +154,4 @@ "dependencies": { "dom-to-image-even-more": "^1.0.4" } -} +} \ No newline at end of file diff --git a/src/extension.js b/src/extension.js index 6f31aa4..62c9588 100644 --- a/src/extension.js +++ b/src/extension.js @@ -12,6 +12,7 @@ const getConfig = () => { const extensionSettings = getSettings('codesnap', [ 'backgroundColor', + 'background', 'boxShadow', 'containerPadding', 'roundedCorners', diff --git a/webview/src/index.js b/webview/src/index.js index b0777e1..0c66c7b 100644 --- a/webview/src/index.js +++ b/webview/src/index.js @@ -23,6 +23,7 @@ window.addEventListener('message', ({ data: { type, ...cfg } }) => { fontLigatures, tabSize, backgroundColor, + background, boxShadow, containerPadding, roundedCorners, @@ -35,6 +36,7 @@ window.addEventListener('message', ({ data: { type, ...cfg } }) => { if (typeof fontLigatures === 'string') setVar('font-features', fontLigatures); setVar('tab-size', tabSize); setVar('container-background-color', backgroundColor); + setVar('container-background', background); setVar('box-shadow', boxShadow); setVar('container-padding', containerPadding); setVar('window-border-radius', roundedCorners ? '4px' : 0); diff --git a/webview/src/snap.js b/webview/src/snap.js index e4e3d79..fa0f62d 100644 --- a/webview/src/snap.js +++ b/webview/src/snap.js @@ -1,3 +1,4 @@ + import { $, $$, redraw, once, setVar } from './util.js'; const vscode = acquireVsCodeApi(); @@ -50,4 +51,5 @@ export const takeSnap = async (config) => { windowNode.style.resize = 'horizontal'; setVar('container-background-color', config.backgroundColor); -}; + setVar('container-background', config.background); +}; \ No newline at end of file diff --git a/webview/style.css b/webview/style.css index 310640e..ad65385 100644 --- a/webview/style.css +++ b/webview/style.css @@ -3,6 +3,7 @@ html { --font-features: initial; --tab-size: 4; --container-background-color: #abb8c3; + --container-background: transparent; --box-shadow: rgba(0, 0, 0, 0.55) 0px 20px 68px; --container-padding: 3em; --window-border-radius: 4px; @@ -29,6 +30,7 @@ body { align-items: center; padding: var(--container-padding); background-color: var(--container-background-color); + background: var(--container-background); width: max-content; } #window {