A powerful Lottie animation theme converter that helps you easily switch between light and dark themes:
Smartly inverts colors of embedded images in Lottie files while maintaining alpha channel transparency.
Perfect for applications requiring both light and dark mode animations.
Easy-to-understand Python script using only Pillow library for image processing.
Efficiently processes base64 encoded images embedded in Lottie JSON files.
- Install requirements:
pip install -r requirements.txt
-
Place your light theme Lottie animation file as "Animation-ClickMe.json"
-
Run the conversion script:
python convert_lottie.py
- Get your dark theme animation in "Animation-ClickMe-dark.json"
First, install the required dependency:
pip install pillow==11.0.0
You can start converting your Lottie animation by following these steps:
- Save your Lottie animation file as "Animation-ClickMe.json"
- Run convert_lottie.py
- The script will generate "Animation-ClickMe-dark.json" with inverted colors
The script processes embedded base64 images in the Lottie JSON file:
- Decodes base64 to image
- Inverts colors while preserving transparency
- Re-encodes to base64
- Updates the Lottie JSON with new image data
Feel free to modify the code to work with different input/output filenames or add additional image processing features!
Created and maintained by Chan Meng.