From 246a1dd81fc198bc90158d9b972fc99327c15057 Mon Sep 17 00:00:00 2001 From: mZeeDevv Date: Sat, 13 Sep 2025 00:21:35 +0500 Subject: [PATCH 1/2] :rocket: Added 14 fonts options for snapshot --- package.json | 22 ++++++++++++++++++++++ src/extension.ts | 3 ++- src/template.ts | 16 ++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 871cc57..ba7d43d 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,28 @@ "default": "one-dark-pro", "description": "Select a theme for the screenshot. This theme will be used to style the code in the screenshot, making it look like it does in the VS Code editor with that theme applied.", "enum": ["dark-plus","dracula-soft","dracula","github-dark-dimmed","github-dark","github-light","hc_light","light-plus","material-theme-darker","material-theme-lighter","material-theme-ocean","material-theme","material-theme-palenight","min-dark","min-light","monokai","nord","one-dark-pro","poimandres","rose-pine-dane","rose-pine","slack-dark","slack-ochin","solarized-dark","solarized-light","vitesse-dark","vitesse-light","rose-pine-dawn","rose-pine-moon","css-variables"] + }, + "capture.fontFamily": { + "type": "string", + "default": "Cascadia Code PL", + "description": "Select a font for the code in the screenshot.", + "enum": [ + "Cascadia Code PL", + "Fira Code", + "JetBrains Mono", + "Source Code Pro", + "Consolas", + "Roboto Mono", + "Ubuntu Mono", + "Inconsolata", + "Anonymous Pro", + "Hack", + "IBM Plex Mono", + "Droid Sans Mono", + "Courier Prime", + "PT Mono", + "Space Mono" + ] } } }] diff --git a/src/extension.ts b/src/extension.ts index 15e32d2..8c42b4e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -33,8 +33,9 @@ export function activate(context: vscode.ExtensionContext) { const configuration = vscode.workspace.getConfiguration('capture'); const themeName = configuration.get('themeName', 'one-dark-pro'); + const fontFamily = configuration.get('fontFamily', 'Cascadia Code PL'); - const content = await generateTemplate(text,themeName); + const content = await generateTemplate(text, themeName, fontFamily); await page.setContent(content); const contentHeight = content.split("\n").length; const totalHeight = contentHeight * 3; diff --git a/src/template.ts b/src/template.ts index 41a4f51..eae4f7f 100644 --- a/src/template.ts +++ b/src/template.ts @@ -8,7 +8,7 @@ const highlightCode = async (themeName: string) => { return highlighter; }; -const generateTemplate = async (content: string, themeName: string) => { +const generateTemplate = async (content: string, themeName: string, fontFamily: string = 'Cascadia Code PL') => { // get hightlighter const highlighter = await highlightCode(themeName); // set content @@ -20,13 +20,20 @@ const generateTemplate = async (content: string, themeName: string) => { + From dac28c1ccf9a307fedcfbc1520642de6d4c52925 Mon Sep 17 00:00:00 2001 From: Hamza Khattak <62940100+mZeeDevv@users.noreply.github.com> Date: Sat, 13 Sep 2025 00:26:47 +0500 Subject: [PATCH 2/2] Updated READMe.md Added fonts: "Cascadia Code PL", "Fira Code", "JetBrains Mono", "Source Code Pro", "Consolas", "Roboto Mono", "Ubuntu Mono", "Inconsolata", "Anonymous Pro", "Hack", "IBM Plex Mono", "Droid Sans Mono", "Courier Prime", "PT Mono", "Space Mono" --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3c3aaaf..b39f56e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ You can take the code snapshot in two steps: - [x] Syntax highlighting - [x] Adjustable image dimensions - [ ] Customizable theme -- [ ] Customizable fonts +- [x] Customizable fonts ## Contributing @@ -47,4 +47,4 @@ Join our community on [Discord](http://discord.devsdope.com/) Give a ⭐️ if this project helped you! ### License -This project is [MIT](https://github.com/khattakdev/capture/blob/main/LICENSE.md) licensed. \ No newline at end of file +This project is [MIT](https://github.com/khattakdev/capture/blob/main/LICENSE.md) licensed.