From 358aae92dc48a9025aaa476984942121f69ab30d Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Mon, 19 Jan 2026 00:53:11 -0400 Subject: [PATCH] seperate color --- src-tauri/src/lib.rs | 8 +++++--- src/App.vue | 3 ++- src/components/HeroView.vue | 3 ++- src/components/SettingsPanel.vue | 19 +++++++++++++++---- src/stores/gallery.ts | 10 +++++++--- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 311e02b..c99c561 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -109,6 +109,7 @@ struct ExportImageTask { manual_position: Option, scale: Option, opacity: Option, + color: Option, } #[derive(serde::Deserialize)] @@ -141,9 +142,8 @@ fn parse_hex_color(hex: &str) -> image::Rgba { #[tauri::command] async fn export_batch(images: Vec, watermark: WatermarkSettings, output_dir: String) -> Result { let font = FontRef::try_from_slice(FONT_DATA).map_err(|e| format!("Font error: {}", e))?; - let base_color = parse_hex_color(&watermark.color); - // Note: opacity and final text color are now calculated per-task + // Note: Settings are now resolved per-task let results: Vec> = images.par_iter().map(|task| { let input_path = Path::new(&task.path); @@ -156,8 +156,10 @@ async fn export_batch(images: Vec, watermark: WatermarkSettings // Determine effective settings (Task > Global) let eff_scale = task.scale.unwrap_or(watermark.scale); let eff_opacity = task.opacity.unwrap_or(watermark.opacity); + let eff_color_hex = task.color.as_ref().unwrap_or(&watermark.color); - // Calculate final color with effective opacity + // Calculate final color + let base_color = parse_hex_color(eff_color_hex); let alpha = (eff_opacity * 255.0) as u8; let text_color = image::Rgba([base_color[0], base_color[1], base_color[2], alpha]); diff --git a/src/App.vue b/src/App.vue index c43d41a..ef95271 100644 --- a/src/App.vue +++ b/src/App.vue @@ -52,7 +52,8 @@ async function exportBatch() { path: img.path, manual_position: img.manualPosition || null, scale: img.scale || null, - opacity: img.opacity || null + opacity: img.opacity || null, + color: img.color || null })); // Pass dummy globals for rust struct compatibility diff --git a/src/components/HeroView.vue b/src/components/HeroView.vue index 73f3b3e..8896cc1 100644 --- a/src/components/HeroView.vue +++ b/src/components/HeroView.vue @@ -75,6 +75,7 @@ const position = computed(() => { const effectiveScale = computed(() => store.selectedImage?.scale ?? store.watermarkSettings.scale); const effectiveOpacity = computed(() => store.selectedImage?.opacity ?? store.watermarkSettings.opacity); +const effectiveColor = computed(() => store.selectedImage?.color ?? store.watermarkSettings.color); const onMouseDown = (e: MouseEvent) => { e.preventDefault(); @@ -159,7 +160,7 @@ const onMouseLeave = () => { top: (position.y * 100) + '%', transform: 'translate(-50%, -50%)', opacity: effectiveOpacity, - color: store.watermarkSettings.color, + color: effectiveColor, /* Scale based on HEIGHT of the IMAGE */ fontSize: (imageRect.height * effectiveScale) + 'px', height: '0px', diff --git a/src/components/SettingsPanel.vue b/src/components/SettingsPanel.vue index e360d5b..d768d75 100644 --- a/src/components/SettingsPanel.vue +++ b/src/components/SettingsPanel.vue @@ -28,8 +28,19 @@ const currentOpacity = computed({ } }); +const currentColor = computed({ + get: () => store.selectedImage?.color ?? store.watermarkSettings.color, + set: (val) => { + if (store.selectedIndex >= 0) { + store.setImageSetting(store.selectedIndex, 'color', val); + } else { + store.updateWatermarkSettings({ color: val }); + } + } +}); + const applyAll = () => { - if (confirm("Apply current size and opacity settings to ALL images? This will reset individual adjustments.")) { + if (confirm("Apply current settings (Size, Opacity, Color) to ALL images?")) { store.applySettingsToAll(); } }; @@ -44,7 +55,7 @@ const applyAll = () => {