A cross-platform desktop application that converts any target color into an equivalent CSS filter value usable for SVG icons or images.
This project is a Python + PyQt port of the original web-based version by Sosuke.
- Convert HEX color → CSS
filter - Real-time preview (Target vs Result)
- Loss score & detailed accuracy info
- Cross-platform: Linux / Windows / macOS
- Portable build via PyInstaller
git clone https://github.com/risky2k1/SVG-Filter.git
cd SVG-Filterpython3 -m venv .venv
source .venv/bin/activate # Linux / macOS
# .venv\Scripts\activate # Windowspip install -r requirements.txtpython main.pypyinstaller build.specpyinstaller build.specExecutable will be available in:
dist/
The app computes a combination of CSS filters (invert, sepia, saturate, hue-rotate, brightness, contrast) that approximates a target color when applied to a black SVG.
Accuracy is measured using:
- Loss score
- Detailed RGB deviation (lossDetail)
Lower loss = closer color match.
The core algorithm was originally derived and explained by MultiplyByZer0 on Stack Overflow:
-
🧠 Original explanation & solution: https://stackoverflow.com/questions/42966641
-
👤 Author profile: https://stackoverflow.com/users/2688027/multiplybyzer0
The solution was later adapted and demonstrated on the web by Sosuke, who converted the algorithm into an interactive JavaScript tool:
- 🌐 CodePen demo: https://codepen.io/sosuke/pen/Pjoqqp
As stated by Sosuke himself, the implementation was inspired by and credits the original Stack Overflow solution by MultiplyByZer0, with slight modifications to focus on HEX colors and practical usage.
This repository is a desktop (PyQt) adaptation of the web demo, and does not claim authorship of the original algorithm.
MIT License
Copyright (c) 2026 Pham Minh Tuan
.venv/,dist/,build/are ignored via.gitignore- Python ≥ 3.9 recommended
