@@ -25,6 +25,8 @@ D:\www\winshot/
2525│ │ ├── App.tsx # Central state management (24KB, 5,452 tokens)
2626│ │ ├── main.tsx # React entry point
2727│ │ ├── types/index.ts # TypeScript interfaces
28+ │ │ ├── utils/ # Utility functions (Phase 2: Color extraction)
29+ │ │ │ └── extract-edge-color.ts
2830│ │ ├── components/ # 14 React components
2931│ │ │ ├── title-bar.tsx
3032│ │ │ ├── capture-toolbar.tsx
@@ -84,7 +86,7 @@ D:\www\winshot/
8486## Go Backend (~ 3,100 LOC)
8587
8688### Package: ` internal/config `
87- ** Files:** config.go (80 LOC), startup.go (100 LOC, Phase 1 update)
89+ ** Files:** config.go (203 LOC), startup.go (100 LOC, Phase 1 update)
8890
8991Manages application configuration persistence and Windows startup registry integration.
9092
@@ -96,6 +98,19 @@ type Config struct {
9698 QuickSave QuickSaveConfig
9799 Export ExportConfig
98100 Window WindowConfig
101+ Editor EditorConfig // Phase 2: Added Inset, AutoBackground
102+ Cloud CloudConfig // R2, Google Drive uploads
103+ }
104+
105+ type EditorConfig struct {
106+ Padding int // Space around screenshot
107+ CornerRadius int // Rounded corners (0-50px)
108+ ShadowSize int // Drop shadow depth
109+ BackgroundColor string // Gradient or solid color
110+ OutputRatio string // Aspect ratio preset
111+ ShowBackground bool // Include background in export
112+ Inset int // Phase 2: 0-50 percentage for screenshot scaling
113+ AutoBackground bool // Phase 2: Auto-extract edge color
99114}
100115
101116type StartupConfig struct {
@@ -444,6 +459,19 @@ Central state management and orchestration.
444459- Keyboard shortcuts for all major operations (see Phase 3 section below)
445460- JPEG quality configuration loaded from app config on startup
446461
462+ ### Utils: ` utils/extract-edge-color.ts `
463+ ** File:** extract-edge-color.ts (Phase 2 - Color Extraction)
464+
465+ Color extraction utility for identifying dominant edge colors from screenshot images.
466+
467+ ** Features:**
468+ - Edge color extraction from image borders
469+ - Dominant color detection algorithm
470+ - Support for color normalization
471+
472+ ** Entry Points:**
473+ - ` extractEdgeColor(imageData) ` - Extract dominant color from image edges
474+
447475### Components (13 total)
448476
449477** Toolbars (4 files):**
@@ -459,7 +487,7 @@ Central state management and orchestration.
459487
460488** Selectors (2 files):**
461489- ` window-picker.tsx ` - Window enumeration + preview
462- - ` hotkey-input.tsx ` - Custom hotkey binding UI
490+ - ` hotkey-input.tsx ` - Custom hotkey binding UI (Phase 01: Preset buttons for browser-blocked keys)
463491- * (region-selector.tsx removed - replaced by native overlay)*
464492
465493** Canvas & Drawing (3 files):**
@@ -796,3 +824,133 @@ User presses Ctrl+V
796824- Quality conversion: Wails canvas API uses 0-1 scale, so ` jpegQuality / 100 `
797825- Config loaded on component mount via ` useEffect ` in GetConfig()
798826- No config UI in Phase 3 (handled in Settings → Export backend)
827+
828+ ---
829+
830+ ## Phase 01 - Preset Buttons for Browser-Blocked Hotkeys (Jan 12, 2026)
831+
832+ ** Overview:** Added preset button UI to HotkeyInput component for easy assignment of PrintScreen-based hotkeys that browsers/WebView2 cannot capture directly.
833+
834+ ** Changes:**
835+ 1 . ** frontend/src/components/hotkey-input.tsx** - Added preset buttons with HOTKEY_PRESETS constant
836+
837+ ** New Feature:**
838+ - ` HOTKEY_PRESETS ` constant defines 3 preset combinations:
839+ - ` PrintScreen ` → label "PrtSc"
840+ - ` Ctrl+PrintScreen ` → label "Ctrl+PrtSc"
841+ - ` Ctrl+Shift+PrintScreen ` → label "Ctrl+Shift+PrtSc"
842+ - Preset buttons displayed below hotkey input field with text "or select preset:"
843+ - Button styling follows glassmorphism design:
844+ - Inactive: ` bg-white/5 text-slate-400 border-white/10 ` (light hover states)
845+ - Active: ` bg-violet-500/30 text-violet-300 border-violet-500/50 ` (purple highlight)
846+ - Disabled: ` opacity-50 cursor-not-allowed ` (grayed out)
847+ - Click preset button → directly sets hotkey value (no need for keyboard input)
848+ - Solves browser blocking of PrintScreen key capture in frontend
849+
850+ ** Technical Details:**
851+ - Presets are static and non-configurable (covers common use cases)
852+ - Button click calls ` onChange(preset.value) ` directly
853+ - Respects disabled state like main input field
854+ - Small font size (text-xs) for compact layout in hotkey form
855+ - Flex wrap allows responsive button layout on small screens
856+
857+ ---
858+
859+ ## Phase 2 - Color Extraction Utility (Jan 12, 2026)
860+
861+ ** Overview:** Created color extraction utility for identifying dominant edge colors from screenshot images.
862+
863+ ** Changes:**
864+ 1 . ** frontend/src/utils/extract-edge-color.ts** - New color extraction utility (foundation for Phase 3+ features)
865+
866+ ** New Files:**
867+ - ` frontend/src/utils/ ` folder created
868+ - ` extract-edge-color.ts ` - Color extraction algorithm with edge detection and normalization
869+
870+ ** Features:**
871+ - Edge color extraction from screenshot borders
872+ - Dominant color detection for palette analysis
873+ - Color normalization for consistent output
874+
875+ ** Purpose:** Foundation utility for future color-based features (auto-background selection, color grading, etc.)
876+
877+ ** Technical Details:**
878+ - Zero dependencies (vanilla TypeScript)
879+ - Pure function design for testability
880+ - Handles multiple color spaces and normalizations
881+
882+ ---
883+
884+ ## Phase 2 - State Management & Backend Config Completion (Jan 12, 2026)
885+
886+ ** Overview:** Finalized state management in React frontend and added editor configuration fields to support Inset and AutoBackground features.
887+
888+ ** Changes:**
889+
890+ 1 . ** frontend/src/App.tsx** - Enhanced state management:
891+ - Added editor state loading from Go backend config (EditorConfig fields)
892+ - Integrated ` Inset ` state for screenshot scaling (0-50 percentage)
893+ - Integrated ` AutoBackground ` state for auto edge-color extraction
894+ - Load editor config on component mount via ` useEffect ` + ` GetEditorConfig() `
895+ - State updates reflect backend config persistence
896+
897+ 2 . ** internal/config/config.go** - Extended EditorConfig:
898+ - Added ` Inset ` field (int, 0-50 percentage) for screenshot inset/scaling
899+ - Added ` AutoBackground ` field (bool) for automatic edge color detection
900+ - Default values: ` Inset: 0 ` , ` AutoBackground: true `
901+ - Both fields persist to ` config.json ` with existing editor settings
902+
903+ ** Architecture:**
904+ - Config persistence: JSON file at ` %APPDATA%\WinShot\config.json `
905+ - Go ↔ TypeScript binding: Wails auto-generates types from Go structs
906+ - Frontend loads config on startup, can modify and persist back to Go
907+ - All editor settings survive app restarts (full persistence layer)
908+
909+ ** State Flow:**
910+ ```
911+ App.tsx startup
912+ → useEffect calls GetEditorConfig()
913+ → Returns EditorConfig {padding, cornerRadius, shadowSize, ...inset, autoBackground}
914+ → setState(editorConfig)
915+ → SettingsPanel displays all fields
916+ → User changes values
917+ → SaveEditorConfig() persists back to Go
918+ → Config written to disk at next save
919+ ```
920+
921+ ** Default Values (Phase 2):**
922+ ``` json
923+ {
924+ "padding" : 40 ,
925+ "cornerRadius" : 12 ,
926+ "shadowSize" : 20 ,
927+ "backgroundColor" : " linear-gradient(135deg, #667eea 0%, #764ba2 100%)" ,
928+ "outputRatio" : " auto" ,
929+ "showBackground" : true ,
930+ "inset" : 0 ,
931+ "autoBackground" : true
932+ }
933+ ```
934+
935+ ** New Config Fields:**
936+ - ** Inset** (0-50): Percentage-based scaling/margin for screenshot content within editor bounds
937+ - 0 = no inset (full screenshot)
938+ - 50 = maximum inset (50% reduction in effective screenshot size)
939+ - Used by frontend to render screenshot with internal margin for visual breathing room
940+
941+ - ** AutoBackground** (true/false): Enable automatic edge color extraction for background
942+ - When true: App can auto-detect dominant edge color and apply as background
943+ - When false: Use user-selected gradient or custom color
944+ - Powered by ` extractDominantEdgeColor() ` utility from Phase 2 color extraction
945+
946+ ** Impact on UI:**
947+ - SettingsPanel now displays Inset slider (0-50 range)
948+ - SettingsPanel now displays AutoBackground toggle
949+ - Changes immediately reflect in EditorCanvas viewport
950+ - All changes persist across app restarts
951+
952+ ** Technical Details:**
953+ - Inset calculation in EditorCanvas affects canvas scaling and positioning
954+ - AutoBackground flag enables/disables color extraction pipeline
955+ - No breaking changes to existing config files (new fields use defaults if missing)
956+ - Full backward compatibility with older config versions
0 commit comments