11import os
22import sys
33import subprocess
4- from utils import api_file_path , data_folder_path , icons_folder_path , display_notification , language , padding
4+ from utils import api_file_path , data_folder_path , icons_folder_path , assets_folder_path , display_notification , language , padding
55def get_homebrew_prefix ():
66 try :
77 prefix = subprocess .check_output (['brew' , '--prefix' ])
@@ -41,7 +41,7 @@ def get_homebrew_prefix():
4141check_e_type = ['flag:' , 'keycap:' ]
4242
4343def convert_emoji_to_png (emoji , name ):
44- image_size = (64 + padding , 64 + padding ) # set image size
44+ image_size = (64 + padding , 64 + padding ) # set image size
4545 image = Image .new ("RGBA" , image_size , (0 , 0 , 0 , 0 )) # Set transparent background
4646 font_size = 64 # Adjusted font size
4747 font_path = "/System/Library/Fonts/Apple Color Emoji.ttc"
@@ -100,6 +100,17 @@ def convert_emoji_to_png(emoji, name):
100100 with open (api_file_path , 'w' , encoding = 'utf-8' ) as file :
101101 json .dump ({'info' : info , 'items' : items }, file , ensure_ascii = False , indent = 4 )
102102
103+ assets = [f for f in os .listdir (assets_folder_path )]
104+
105+ for i in assets :
106+ image_path = os .path .join (assets_folder_path , i )
107+ image = Image .open (image_path )
108+ width , height = image .size
109+ new_image = Image .new ("RGBA" , (width + padding , height + padding ), (0 , 0 , 0 , 0 ))
110+ new_image .paste (image , (int (padding / 2 ), int (padding / 2 )))
111+ output_path = os .path .join (icons_folder_path , i )
112+ new_image .save (output_path )
113+
103114 display_notification ('✅ Success !' , 'Data updated. You can search emojis' )
104115except :
105116 display_notification ('🚨 Error !' , 'Something went wrong, check your internet connexion or create a GitHub issue' )
0 commit comments