TIMBOVILL commited on
Commit
fba0183
·
verified ·
1 Parent(s): 2d78709

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -1,14 +1,10 @@
1
- import gradio as gr
2
- from PIL import Image
3
- import os
4
- import zipfile
5
- import tempfile
6
- import shutil
7
 
8
  def recolor_icons(zip_file, hex_color):
9
- # Convert hex color to RGB tuple
10
- hex_color = hex_color.lstrip("#")
11
- target_rgb = tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
12
 
13
  # Set up temp directories
14
  temp_input_dir = tempfile.mkdtemp()
 
1
+ from PIL import Image, ImageColor
2
+ import os, zipfile, tempfile, shutil
 
 
 
 
3
 
4
  def recolor_icons(zip_file, hex_color):
5
+ target_rgb = ImageColor.getrgb(hex_color) # Fixed: handles "red", "#ff0000", etc.
6
+
7
+ # Rest of the function...
8
 
9
  # Set up temp directories
10
  temp_input_dir = tempfile.mkdtemp()