mirror of
				https://github.com/eledio-helpers/svg-color-replacer.git
				synced 2025-10-31 00:42:44 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			510 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			510 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 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()
 |