From b5d3a23980fa40f2b7a53485e3d2d2063f220c7b Mon Sep 17 00:00:00 2001 From: Tal Hayut Date: Tue, 17 Mar 2026 16:15:12 -0400 Subject: [PATCH 1/2] feat: backgrounds --- src/cli.ts | 15 +++++++++++++++ src/utils.ts | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/cli.ts b/src/cli.ts index f991eaf..415dcfd 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -141,6 +141,21 @@ const createParser = () => type: 'string', describe: 'Footer background color (hex)', }) + .option('background', { + alias: 'b', + type: 'string', + describe: 'Background color or gradient (e.g., "#1a1a2e" or "gradient(#ff0000, #0000ff:diagonal)")', + }) + .option('background-padding', { + alias: 'B', + type: 'number', + describe: 'Padding around terminal when background is set (default: 20)', + }) + .option('background-radius', { + alias: 'a', + type: 'number', + describe: 'Border radius for background (default: 12)', + }) .option('list-themes', { alias: 'L', type: 'boolean', diff --git a/src/utils.ts b/src/utils.ts index 9380918..3238c40 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -25,6 +25,9 @@ export interface CliArgs { 'header-color'?: string; 'footer-height'?: number; 'footer-color'?: string; + 'background'?: string; + 'background-padding'?: number; + 'background-radius'?: number; 'list-themes'?: boolean; 'list-templates'?: boolean; } @@ -54,6 +57,7 @@ export interface BuildOptionsResult { embedFont: boolean; header?: { height?: number; backgroundColor?: string }; footer?: { height?: number; backgroundColor?: string }; + background?: string | { color: string; padding?: number; borderRadius?: number }; } type Padding = number | [number, number] | [number, number, number, number]; @@ -167,6 +171,20 @@ const buildWatermark = ( return { content, style: parseStyleString(styleStr) }; }; +const buildBackground = ( + color: string | undefined, + padding: number | undefined, + borderRadius: number | undefined +): string | { color: string; padding?: number; borderRadius?: number } | undefined => { + if (color === undefined) return undefined; + if (padding === undefined && borderRadius === undefined) return color; + return { + color, + ...(padding !== undefined && { padding }), + ...(borderRadius !== undefined && { borderRadius }), + }; +}; + export const buildOptions = (argv: Partial): BuildOptionsResult => ({ template: (argv.template as 'macos' | 'windows' | 'minimal') ?? 'macos', fontSize: argv['font-size'] ?? 14, @@ -183,4 +201,5 @@ export const buildOptions = (argv: Partial): BuildOptionsResult => ({ ...(argv['font-family'] !== undefined && { fontFamily: argv['font-family'] }), ...({ header: buildHeaderFooter(argv['header-height'], argv['header-color']) }), ...({ footer: buildHeaderFooter(argv['footer-height'], argv['footer-color']) }), + ...(argv['background'] !== undefined && { background: buildBackground(argv['background'], argv['background-padding'], argv['background-radius']) }), }); From f02599a9f22f114cbe5e69b33f8fe81d38a48a21 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 17 Mar 2026 20:15:57 +0000 Subject: [PATCH 2/2] chore: update shellfie to v2.2.0 --- package-lock.json | 12 ++++++------ package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8150a32..c6bc982 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "shellfie-cli", - "version": "2.1.3", + "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "shellfie-cli", - "version": "2.1.3", + "version": "2.2.0", "license": "MIT", "dependencies": { - "shellfie": "^2.1.3", + "shellfie": "^2.2.0", "yargs": "^17.7.2" }, "bin": { @@ -1356,9 +1356,9 @@ } }, "node_modules/shellfie": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/shellfie/-/shellfie-2.1.3.tgz", - "integrity": "sha512-YET9YkKbJ43i+3MZxFSxLzsJohBuORVmM3baN2wjqfaI0JpPsbDZpORStIF2UlhPE7WpGZw6/ccz1eJR/0a20A==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/shellfie/-/shellfie-2.2.0.tgz", + "integrity": "sha512-CAPWEt/8tl6kylP6BqwEvlq96xcry+MuKCb01JCeT7JxhOUdj0D2AfsPMREVieoBdqrXGAwn04ovdPfQfWyBkg==", "license": "MIT", "engines": { "node": ">=18.0.0" diff --git a/package.json b/package.json index 860e3b1..296d1b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "shellfie-cli", - "version": "2.1.3", + "version": "2.2.0", "description": "Terminal output to beautiful SVGs", "bin": { "shellfie": "dist/cli.js" @@ -35,7 +35,7 @@ "url": "https://github.com/tool3/shellfie-cli" }, "dependencies": { - "shellfie": "^2.1.3", + "shellfie": "^2.2.0", "yargs": "^17.7.2" }, "devDependencies": {