SVG Recolor is a simple CLI tool, API and website to recolor SVG files. It is written in python.
Note
Submodules have their own licenses and may or may not be covered by the license of this project. Check the submodule's license for details.
Warning
This project is still under construction and may not be fully functional yet.
Website: Use the intuitive web interface to recolor SVG files without any setup. API: Integrate SVG recoloring into your applications with ease. CLI Tool: Recolor SVG files directly from your terminal with this Python script. Legacy Shell Script: Same as above, but with a shell script (not maintained).
The website is hosted at svg-recolor.vercel.app and requires no installation.
The API is hosted at the same url as the website. You can find the swagger documentation on svg-recolor.vercel.app/docs or svg-recolor.vercel.app/redoc if you prefer the redoc style.
Simply dowload colorize_svg.py
and run it with python.
Example usage:
python colorize_svg.py path/to/input.svg path/to/output.svg --color "255,0,0"
Download colorize_svg.sh
and run it in your terminal.
Example Usage:
# Recolor the input SVG file to red and save it to the output file using RGB color values
./colorize_svg.sh "example-input-svgs/input.svg" tmp/output.svg --color "255,0,0"
# Recolor the input SVG file to red and save it to the output file using hex color values
./colorize_svg.sh "example-input-svgs/input.svg" tmp/output.svg --color "#FF0000"
See any bugs or missing features? Feel free to open an issue or submit a pull request, I'm open to anything! Check out Local Development for more information on how to set up the project locally.
Other ways to contribute:
- Python 3.10 or higher
- Pipenv
Clone the repository and install the dependencies using pipenv.
git clone https://github.com/Snailedlt/svg-recolor.git
cd svg-recolor
pipenv install
Compile svgshift (a submodule) by running the following command
Replace <your-environment>
with your environment (e.g. windows, linux).
gcc submodules/svgshift/svgshift.c -o svgshift-<your-environment>.exe
To run the API, use the following command:
pipenv run dev
If you wish to run the CLI without downloading the required dependencies to a separate virtual env, you can use the following command:
# Update the dependencies if you haven't already
pipenv update
pipenv run colorize path/to/input.svg path/to/output.svg --color "255,0,0"