Commit Graph

19 Commits

Author SHA1 Message Date
d.viti
9ff03cd41a feat: Add logo and color palette support to project-mode
Features added to project-mode.html:
- Logo upload section in 'Dati Azienda' (matches shop-mode design)
- Base64 logo encoding and preview
- K-means color palette extraction (5-7 colors)
- Average color calculation as brand color
- Visual palette display with color chips

Functions copied from shop-mode:
- handleLogoUpload() - File upload with size validation (2MB max)
- extractDominantColor() - K-means clustering algorithm
- kMeansClustering() - Palette extraction with convergence
- rgbToHex() / hexToRgb() - Color conversion utilities

PDF improvements:
- generaPDFCliente() now includes logo in header
- generaPDFInterno() now includes logo in header
- Dynamic brand colors from extracted palette
- Responsive layout (centered without logo, left-aligned with logo)
- White card background for logo with subtle border

Data persistence:
- logoColor and colorPalette added to salvaDati()
- Logo and palette restored in caricaPreventivoSalvato()

UI features:
- Drag & drop logo upload
- Real-time color extraction on upload
- Palette visualization (8x8px color chips with hover effect)
- Brand color display with hex value
- Delete logo button

Algorithm specs:
- Skip whites (RGB > 235), blacks (< 20), grays (sat < 0.2)
- 3-6 clusters based on image complexity
- 10 iterations with early convergence
- Lightness filter (0.25-0.80 range)
- Sort by saturation (most vibrant first)

Both modes now have identical logo/branding features!
2025-10-14 00:27:00 +02:00
d.viti
95f26e1bd4 feat: K-means color palette extraction with average brand color
Algorithm improvements:
- Implemented K-means clustering (3-6 clusters based on image size)
- Extract complete color palette from logo (5-7 representative colors)
- Calculate average RGB of palette colors as final brand color
- Sort palette by saturation (most vibrant colors first)

Filters applied:
- Skip whites (RGB > 235), blacks (RGB < 20), grays (saturation < 0.2)
- Filter palette by lightness (0.25-0.80 range)
- 10 iterations K-means with convergence check

UI improvements:
- Show extracted color palette as color chips
- Display final brand color (average of palette)
- Labeled as 'Colore Brand (media palette)'
- Hover effect on palette colors with tooltips
- Console logging for debugging

Benefits:
- More accurate color extraction from complex logos
- Avoids picking background colors (white/black)
- Represents true brand identity (not just most common)
- Works better with gradients and multi-color logos
- Average creates balanced, professional brand color
2025-10-14 00:22:47 +02:00
d.viti
546d7201b0 feat: Advanced color palette extraction algorithm
- Build complete color palette instead of single dominant color
- Filter out whites (RGB > 240), blacks (RGB < 15), and grays (saturation < 0.15)
- Calculate HSL values for better color analysis
- Quantize colors to group similar shades together
- Score colors based on:
  * Saturation (prefer vibrant colors)
  * Frequency (weight by occurrence)
  * Optimal lightness (0.4-0.6 range preferred)
- Select best scoring color from palette
- Skip too light (> 0.85) or too dark (< 0.20) colors
- Improved sampling rate (every 4 pixels instead of 10)
- Console logging for debugging extracted palette
- Fallback to emerald green if no suitable colors found
2025-10-14 00:16:37 +02:00
d.viti
e1173a1fbc feat: Modernized PDF design with web panel style and dynamic branding
- Added logo upload functionality with base64 encoding
- Automatic dominant color extraction from logo
- Complete PDF redesign with modern card-based layout
- Gradient header with company logo and name
- Information cards for vendor and client data
- Table with alternating row backgrounds
- Summary box with brand color highlights
- Per-item IVA support in calculations and PDF
- Dynamic accent colors based on logo
- Responsive layout with rounded corners and shadows
- Professional footer with generation timestamp
2025-10-14 00:14:55 +02:00
d.viti
ea504d7b37 Add logo upload and color extraction for vendor
- Allow uploading a company logo and extract its dominant color - Show
logo preview and extracted color in the UI - Use logo and color for PDF
branding and styling - Add per-item IVA field and calculation - Update
PDF export to show logo, brand color, and IVA per item
2025-10-14 00:12:07 +02:00
d.viti
7a5e8e5760 Add advanced shop-mode calculator with PDF export and save/load
All checks were successful
Build and Deploy / build (push) Successful in 29s
2025-10-13 23:58:21 +02:00
d.viti
f300f2b041 Simplify Dockerfile and remove custom nginx config
All checks were successful
Build and Deploy / build (push) Successful in 30s
2025-10-13 23:33:58 +02:00
d.viti
23ec5d5f32 Add multi-mode HTML, Docker, Helm chart, and deploy script
All checks were successful
Build and Deploy / build (push) Successful in 46s
- Add shop-mode.html and project-mode.html for separate calculation
modes - Refactor index.html as a landing page for mode selection - Add
Dockerfile with optimized nginx config and healthcheck - Add
.dockerignore for cleaner Docker builds - Add deploy.sh for
Helm/Kubernetes deployment automation - Add helm-chart/ with
values.yaml, Chart.yaml, templates, and documentation - Update README.md
with full instructions, features, and CI/CD examples
2025-10-13 23:25:33 +02:00
68d1c91456 Update .gitea/workflows/build.yml
All checks were successful
Build and Deploy / build (push) Successful in 26s
2025-10-06 16:30:54 +02:00
6a46395c1c Update .gitea/workflows/build.yml
Some checks failed
Build and Deploy / build (push) Has been cancelled
2025-10-06 16:30:06 +02:00
fb3dfeabaf Update .gitea/workflows/build.yml
Some checks failed
Build and Deploy / build (push) Has been cancelled
2025-10-06 16:29:54 +02:00
2e1516ce48 Update index.html
All checks were successful
Build and Deploy / build (push) Successful in 24s
2025-09-24 00:36:22 +02:00
4dba11f303 Update index.html
All checks were successful
Build and Deploy / build (push) Successful in 24s
2025-09-24 00:15:23 +02:00
76a8a576e3 Update index.html
All checks were successful
Build and Deploy / build (push) Successful in 24s
2025-09-23 23:54:06 +02:00
1b00300fc8 Update .gitea/workflows/build.yml
All checks were successful
Build and Deploy / build (push) Successful in 24s
2025-09-23 23:27:17 +02:00
d.viti
758f75da43 Update build.yml
All checks were successful
Build and Deploy / build (push) Successful in 25s
2025-09-20 01:20:02 +02:00
d.viti
972dc5cee8 aggiunto docker
Some checks failed
Build and Deploy / build (push) Failing after 4m10s
2025-09-20 00:14:41 +02:00
174fa447bc Add index.html 2025-09-19 23:49:09 +02:00
2194f2a082 Initial commit 2025-09-19 23:48:40 +02:00