https://github.com/niklashenning/pytablericons
A Python wrapper for the Tabler Icons library with 5237 high-quality icons
https://github.com/niklashenning/pytablericons
icon icon-pack icons icons-pack iconset pillow pyqt5 pyqt6 pyside6 python quality-svg-icons svg svg-icons tabler-icons
Last synced: 19 days ago
JSON representation
A Python wrapper for the Tabler Icons library with 5237 high-quality icons
- Host: GitHub
- URL: https://github.com/niklashenning/pytablericons
- Owner: niklashenning
- License: mit
- Created: 2024-04-14T18:23:26.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-08-22T21:59:48.000Z (8 months ago)
- Last Synced: 2025-04-13T07:47:34.176Z (19 days ago)
- Topics: icon, icon-pack, icons, icons-pack, iconset, pillow, pyqt5, pyqt6, pyside6, python, quality-svg-icons, svg, svg-icons, tabler-icons
- Language: Python
- Homepage: https://pypi.org/project/pytablericons/
- Size: 1.43 MB
- Stars: 58
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pytablericons
[](https://pypi.org/project/pytablericons)
[](https://github.com/niklashenning/pytablericons)
[](https://github.com/niklashenning/pytablericons)
[](https://github.com/niklashenning/pytablericons)
[](https://github.com/niklashenning/pytablericons/blob/master/LICENSE)Python wrapper for the **[Tabler Icons](https://github.com/tabler/tabler-icons)** library - a set of 5237 free MIT-licensed high-quality SVG icons for you to use in your python projects
![]()
## Features
- 5237 free MIT-licensed high-quality SVG icons
- Load icons into Pillow Image with custom size, color, and stroke width
- Supports IDE autocompletion
- Works cross-platform without any extra dependencies
- Easy to use with `Pillow`, `PyQt5`, `PyQt6`, `PySide2`, `PySide6`, `Tkinter`, etc.## Installation
```python
pip install pytablericons
```## Usage
Import `TablerIcons` and call the static `load()` method with the desired `OutlineIcon` or `FilledIcon`:
```python
from pytablericons import TablerIcons, OutlineIcon, FilledIconicon_rotate = TablerIcons.load(OutlineIcon.ROTATE) # Outline icon
icon_check = TablerIcons.load(FilledIcon.CIRCLE_CHECK) # Filled icon
```> **NOTE:**
The icon names are the same as on the tabler-icons.io site, except every letter is uppercase and hyphens are replaced with underscores.
Examples: `rotate` → `ROTATE`, `arrow-down-right` → `ARROW_DOWN_RIGHT`## Customization
Setting a custom size, color, and stroke width:
```python
# Width and height 100px (default: 24)
icon_custom_size = TablerIcons.load(OutlineIcon.ROTATE, size=100)# Color red (default: '#FFF')
icon_custom_color = TablerIcons.load(OutlineIcon.ROTATE, color='#ff0000')# Stroke width 1.5 (default: 2.0)
icon_custom_stroke_width = TablerIcons.load(OutlineIcon.ROTATE, stroke_width=1.5)# Combining everything
icon_custom = TablerIcons.load(OutlineIcon.ROTATE, size=100, color='#ff0000', stroke_width=1.5)
```> **NOTE:**
The color can either be a **hex color** or one of very limited **color names**.
Examples: `'#ec3440'`, `'#581790'`, `'red'`, `'green'`, `'blue'`## Examples
- **Using an icon with Pillow:**
```python
from pytablericons import TablerIcons, FilledIconicon = TablerIcons.load(FilledIcon.CIRCLE_CHECK) # Load icon
icon.show() # Show icon
print(icon.size) # Print icon size
```- **Using an icon with PyQt6:**
```python
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QMainWindow, QPushButton
from pytablericons import TablerIcons, OutlineIconclass Window(QMainWindow):
def __init__(self):
super().__init__(parent=None)
# Load icon
icon_rotate = TablerIcons.load(OutlineIcon.ROTATE, color='#000')
# Create button with icon
self.button = QPushButton(self)
self.button.setText('Rotate')
self.button.setIcon(QIcon(icon_rotate.toqpixmap()))
```- **Using an icon with Tkinter:**
```python
from PIL import ImageTk
from tkinter import Tk, Button
from tkinter.constants import *
from pytablericons import TablerIcons, OutlineIcon# Create window
root = Tk()# Load icon and convert to ImageTk
icon_rotate = TablerIcons.load(OutlineIcon.ROTATE, size=16, color='#000', stroke_width=3.0)
icon_rotate_tk_image = ImageTk.PhotoImage(icon_rotate)# Create button with icon
button = Button(root, text='Rotate', image=icon_rotate_tk_image, compound=LEFT)
button.pack(padx=50, pady=25)# Run event loop
root.mainloop()
```More in-depth examples can be found in the [examples](https://github.com/niklashenning/pytablericons/blob/master/examples) folder.
## Preview
### Outline version (4577 icons)
![]()
### Filled version (660 icons)
![]()
## Tests
Installing the required test dependencies [pytest](https://github.com/pytest-dev/pytest) and [coveragepy](https://github.com/nedbat/coveragepy):
```
pip install pytest coverage
```To run the tests with coverage, clone this repository, go into the main directory and run:
```
coverage run -m pytest
coverage report --ignore-errors -m
```## License
This software is licensed under the [MIT license](https://github.com/niklashenning/pytablericons/blob/master/LICENSE).