Skip to content

risky2k1/SVG-Filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVG Filter Generator (Desktop App)

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.


✨ Features

  • 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

🖼 Preview

image

🚀 Getting Started

1️⃣ Clone repository

git clone https://github.com/risky2k1/SVG-Filter.git
cd SVG-Filter

2️⃣ Create virtual environment

python3 -m venv .venv
source .venv/bin/activate   # Linux / macOS
# .venv\Scripts\activate  # Windows

3️⃣ Install dependencies

pip install -r requirements.txt

4️⃣ Run application

python main.py

📦 Build Standalone App

Linux / macOS

pyinstaller build.spec

Windows

pyinstaller build.spec

Executable will be available in:

dist/

🧠 How It Works

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.


🔗 Original Algorithm & Reference

The core algorithm was originally derived and explained by MultiplyByZer0 on Stack Overflow:

The solution was later adapted and demonstrated on the web by Sosuke, who converted the algorithm into an interactive JavaScript tool:

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.


🛡 License

MIT License

Copyright (c) 2026 Pham Minh Tuan


📌 Notes

  • .venv/, dist/, build/ are ignored via .gitignore
  • Python ≥ 3.9 recommended

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages