Skip to content

【Stars are like virtual high-fives - come on, don't leave us hanging!⭐️】A Python tool to convert Lottie animations between light and dark themes by inverting animation colors while preserving transparency.

License

Notifications You must be signed in to change notification settings

ChanMeng666/lottie-edit

Repository files navigation

Lottie Theme Converter


Features

A powerful Lottie animation theme converter that helps you easily switch between light and dark themes:

⚡ Color Inversion While Preserving Transparency

Smartly inverts colors of embedded images in Lottie files while maintaining alpha channel transparency.

🎨 Support for Both Light & Dark Themes

Perfect for applications requiring both light and dark mode animations.

💻 Simple Python Implementation

Easy-to-understand Python script using only Pillow library for image processing.

🔄 Base64 Image Handling

Efficiently processes base64 encoded images embedded in Lottie JSON files.

🤔 How to Use

  1. Install requirements:
pip install -r requirements.txt
  1. Place your light theme Lottie animation file as "Animation-ClickMe.json"

  2. Run the conversion script:

python convert_lottie.py
  1. Get your dark theme animation in "Animation-ClickMe-dark.json"

Tech Used

Python Pillow

Getting Started

First, install the required dependency:

pip install pillow==11.0.0

You can start converting your Lottie animation by following these steps:

  1. Save your Lottie animation file as "Animation-ClickMe.json"
  2. Run convert_lottie.py
  3. The script will generate "Animation-ClickMe-dark.json" with inverted colors

Learn More

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!

🙋‍♀ Author

Created and maintained by Chan Meng.

About

【Stars are like virtual high-fives - come on, don't leave us hanging!⭐️】A Python tool to convert Lottie animations between light and dark themes by inverting animation colors while preserving transparency.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages