Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add codesnap.background #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -148,4 +154,4 @@
"dependencies": {
"dom-to-image-even-more": "^1.0.4"
}
}
}
1 change: 1 addition & 0 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const getConfig = () => {

const extensionSettings = getSettings('codesnap', [
'backgroundColor',
'background',
'boxShadow',
'containerPadding',
'roundedCorners',
Expand Down
2 changes: 2 additions & 0 deletions webview/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ window.addEventListener('message', ({ data: { type, ...cfg } }) => {
fontLigatures,
tabSize,
backgroundColor,
background,
boxShadow,
containerPadding,
roundedCorners,
Expand All @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion webview/src/snap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { $, $$, redraw, once, setVar } from './util.js';

const vscode = acquireVsCodeApi();
Expand Down Expand Up @@ -50,4 +51,5 @@ export const takeSnap = async (config) => {

windowNode.style.resize = 'horizontal';
setVar('container-background-color', config.backgroundColor);
};
setVar('container-background', config.background);
};
2 changes: 2 additions & 0 deletions webview/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down