From 1a2c622d4fe5ce84139f202a5f66d30b1deac614 Mon Sep 17 00:00:00 2001 From: Vladimir Haltakov Date: Tue, 10 Feb 2026 00:27:59 +0100 Subject: [PATCH 1/3] chore: improve error logging --- gallery/src/modules/build/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gallery/src/modules/build/index.ts b/gallery/src/modules/build/index.ts index cb3b37a..08ff741 100644 --- a/gallery/src/modules/build/index.ts +++ b/gallery/src/modules/build/index.ts @@ -383,10 +383,10 @@ export async function build(options: BuildOptions, ui: ConsolaInstance): Promise } else if (error.message.includes('Theme directory not found') || error.message.includes('package.json not found')) { ui.error(error.message); } else { - ui.error('Error building gallery'); + ui.error(`Error building gallery: ${error.message}`); } } else { - ui.error('Error building gallery'); + ui.error(`Error building gallery: ${error}`); } throw error; From 41af5915d9146fce1ef1d5f283ca899243ce9ed6 Mon Sep 17 00:00:00 2001 From: Vladimir Haltakov Date: Tue, 10 Feb 2026 00:34:20 +0100 Subject: [PATCH 2/3] fix: simpler and more robust caption background --- common/src/client/photoswipe/lightbox.ts | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/common/src/client/photoswipe/lightbox.ts b/common/src/client/photoswipe/lightbox.ts index c71e2c0..0fc7584 100644 --- a/common/src/client/photoswipe/lightbox.ts +++ b/common/src/client/photoswipe/lightbox.ts @@ -31,17 +31,13 @@ export interface GalleryLightboxOptions { const CAPTION_SAMPLE_SIZE = 50; const CAPTION_SAMPLE_HEIGHT_RATIO = 0.15; -/* Caption background endpoints for brightness interpolation (0=dark image, 1=light image) */ -const CAPTION_BG_DARK = { r: 255, g: 255, b: 255, a: 0.5 }; // white frost on dark images -const CAPTION_BG_LIGHT = { r: 0, g: 0, b: 0, a: 0.8 }; // dark frost on light images - -function interpolateCaptionBg(brightness: number): string { - const t = Math.min(1, Math.max(0, brightness / 255)); - const r = Math.round(CAPTION_BG_DARK.r + (CAPTION_BG_LIGHT.r - CAPTION_BG_DARK.r) * t); - const g = Math.round(CAPTION_BG_DARK.g + (CAPTION_BG_LIGHT.g - CAPTION_BG_DARK.g) * t); - const b = Math.round(CAPTION_BG_DARK.b + (CAPTION_BG_LIGHT.b - CAPTION_BG_DARK.b) * t); - const a = +(CAPTION_BG_DARK.a + (CAPTION_BG_LIGHT.a - CAPTION_BG_DARK.a) * t).toFixed(3); - return `rgba(${r}, ${g}, ${b}, ${a})`; +/* Caption backgrounds chosen based on image brightness */ +const CAPTION_BG_DARK = 'rgba(255, 255, 255, 0.5)'; // white frost on dark images +const CAPTION_BG_LIGHT = 'rgba(0, 0, 0, 0.8)'; // dark frost on light images +const BRIGHTNESS_THRESHOLD = 80; + +function captionBgForBrightness(brightness: number): string { + return brightness >= BRIGHTNESS_THRESHOLD ? CAPTION_BG_LIGHT : CAPTION_BG_DARK; } /** @@ -168,7 +164,7 @@ export async function createGalleryLightbox(options: GalleryLightboxOptions = {} if (brightness === null) { el.style.removeProperty('--pswp-caption-bg'); } else { - el.style.setProperty('--pswp-caption-bg', interpolateCaptionBg(brightness)); + el.style.setProperty('--pswp-caption-bg', captionBgForBrightness(brightness)); } }; From 5222a4286756ccaeae2e2284f7604077d85c2166 Mon Sep 17 00:00:00 2001 From: Vladimir Haltakov Date: Tue, 10 Feb 2026 00:36:41 +0100 Subject: [PATCH 3/3] chore: increase version to 2.1.5 --- common/package.json | 2 +- gallery/package.json | 6 +++--- .../modules/create-theme/templates/base/package.json | 2 +- themes/modern/package.json | 4 ++-- yarn.lock | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/package.json b/common/package.json index 5cd0e96..6fd72ed 100644 --- a/common/package.json +++ b/common/package.json @@ -1,6 +1,6 @@ { "name": "@simple-photo-gallery/common", - "version": "2.1.4", + "version": "2.1.5", "description": "Shared utilities and types for Simple Photo Gallery", "license": "MIT", "author": "Vladimir Haltakov, Tomasz Rusin", diff --git a/gallery/package.json b/gallery/package.json index ecff5a5..c7094a1 100644 --- a/gallery/package.json +++ b/gallery/package.json @@ -1,6 +1,6 @@ { "name": "simple-photo-gallery", - "version": "2.1.4", + "version": "2.1.5", "description": "Simple Photo Gallery CLI", "license": "MIT", "author": "Vladimir Haltakov, Tomasz Rusin", @@ -47,8 +47,8 @@ "prepublish": "yarn build" }, "dependencies": { - "@simple-photo-gallery/common": "2.1.4", - "@simple-photo-gallery/theme-modern": "2.1.4", + "@simple-photo-gallery/common": "2.1.5", + "@simple-photo-gallery/theme-modern": "2.1.5", "axios": "^1.12.2", "blurhash": "^2.0.5", "commander": "^12.0.0", diff --git a/gallery/src/modules/create-theme/templates/base/package.json b/gallery/src/modules/create-theme/templates/base/package.json index a315cdb..32912fd 100644 --- a/gallery/src/modules/create-theme/templates/base/package.json +++ b/gallery/src/modules/create-theme/templates/base/package.json @@ -27,7 +27,7 @@ "photoswipe": "^5.4.4" }, "peerDependencies": { - "@simple-photo-gallery/common": "^2.1.4" + "@simple-photo-gallery/common": "^2.1.5" }, "devDependencies": { "@eslint/eslintrc": "^3.3.1", diff --git a/themes/modern/package.json b/themes/modern/package.json index 005bb68..2b0e81f 100644 --- a/themes/modern/package.json +++ b/themes/modern/package.json @@ -1,6 +1,6 @@ { "name": "@simple-photo-gallery/theme-modern", - "version": "2.1.4", + "version": "2.1.5", "description": "Modern theme for Simple Photo Gallery", "license": "MIT", "author": "Vladimir Haltakov, Tomasz Rusin", @@ -36,7 +36,7 @@ "devDependencies": { "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.30.1", - "@simple-photo-gallery/common": "2.1.4", + "@simple-photo-gallery/common": "2.1.5", "@types/photoswipe": "^4.1.6", "@typescript-eslint/eslint-plugin": "^8.35.1", "@typescript-eslint/parser": "^8.35.1", diff --git a/yarn.lock b/yarn.lock index a2d53b1..c2a1b37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1652,7 +1652,7 @@ __metadata: languageName: node linkType: hard -"@simple-photo-gallery/common@npm:2.1.4, @simple-photo-gallery/common@workspace:common": +"@simple-photo-gallery/common@npm:2.1.5, @simple-photo-gallery/common@workspace:common": version: 0.0.0-use.local resolution: "@simple-photo-gallery/common@workspace:common" dependencies: @@ -1687,13 +1687,13 @@ __metadata: languageName: unknown linkType: soft -"@simple-photo-gallery/theme-modern@npm:2.1.4, @simple-photo-gallery/theme-modern@workspace:themes/modern": +"@simple-photo-gallery/theme-modern@npm:2.1.5, @simple-photo-gallery/theme-modern@workspace:themes/modern": version: 0.0.0-use.local resolution: "@simple-photo-gallery/theme-modern@workspace:themes/modern" dependencies: "@eslint/eslintrc": "npm:^3.3.1" "@eslint/js": "npm:^9.30.1" - "@simple-photo-gallery/common": "npm:2.1.4" + "@simple-photo-gallery/common": "npm:2.1.5" "@types/photoswipe": "npm:^4.1.6" "@typescript-eslint/eslint-plugin": "npm:^8.35.1" "@typescript-eslint/parser": "npm:^8.35.1" @@ -8570,8 +8570,8 @@ __metadata: dependencies: "@eslint/eslintrc": "npm:^3.3.1" "@eslint/js": "npm:^9.30.1" - "@simple-photo-gallery/common": "npm:2.1.4" - "@simple-photo-gallery/theme-modern": "npm:2.1.4" + "@simple-photo-gallery/common": "npm:2.1.5" + "@simple-photo-gallery/theme-modern": "npm:2.1.5" "@types/fs-extra": "npm:^11.0.4" "@types/jest": "npm:^30.0.0" "@types/node": "npm:^24.0.10"