mirror of
				https://github.com/eledio-helpers/svg-color-replacer.git
				synced 2025-10-31 00:42:44 +01:00 
			
		
		
		
	Add project
This commit is contained in:
		
							
								
								
									
										24
									
								
								svg-color-replacer.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								svg-color-replacer.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| import os | ||||
| import glob | ||||
|  | ||||
| OLD_COLORS = ["black", "#000000"] | ||||
| NEW_COLOR = "#141B5D" | ||||
|  | ||||
| FOLDER_PATH = "img" | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     for file_path in glob.glob(os.path.join(FOLDER_PATH, "*.svg")): | ||||
|         with open(file_path, "r", encoding="utf-8") as file: | ||||
|             content = file.read() | ||||
|  | ||||
|  | ||||
|         for old_color in OLD_COLORS: | ||||
|             content = content.replace(old_color, NEW_COLOR) | ||||
|  | ||||
|  | ||||
|         with open(file_path, "w", encoding="utf-8") as file: | ||||
|             file.write(content) | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     main() | ||||
		Reference in New Issue
	
	Block a user