A Flask-based API service for serving Material Design icons as SVG files. This project provides a simple interface to search and retrieve Material Design icons in various styles.
- Search for Material Design icons by name
- Filter icons by style (baseline, outlined, rounded, sharp, twotone)
- Serve SVG files directly
- RESTful API endpoints
- Cross-Origin Resource Sharing (CORS) support
- Clone the repository:
git clone https://github.com/devatrii/material-icons-api-python.git
cd material-icons-api-python
- Install dependencies:
pip install -r requirements.txt
Run the Flask application:
python main.py
The server will start on http://0.0.0.0:2005
.
GET /search/<query>?style=<style>
Parameters:
query
: The name of the icon to search forstyle
(optional): Filter by style (baseline, outlined, rounded, sharp, twotone)
Example:
GET /search/account_circle?style=outlined
Response:
{
"status": true,
"message": "",
"data": [
{
"name": "account_circle",
"varients": ["twotone", "baseline", "round", "outline", "sharp"]
}
]
}
GET /icon/<icon_name>?style=<style>
Parameters:
icon_name
: The name of the icon to retrievestyle
(optional): The style of the icon (defaults to "baseline")
Example:
GET /icon/account_circle?style=outlined
Response: SVG file content
main.py
: Flask application setup and configurationapi_routes.py
: API endpoint definitionsconverter.ipynb
: Jupyter notebook for data conversion (if applicable)icons_db.json
: Database of available icons and their variantssvg/
: Directory containing SVG files
- Add the SVG files to the appropriate directories in the
svg/
folder - Update the
icons_db.json
file with the new icon information
To add new endpoints, modify the api_routes.py
file and add new route handlers.
Contributions are welcome! Please feel free to submit a Pull Request.