# pytablericons
[![PyPI](https://img.shields.io/badge/pypi-v1.0.0-blue)](https://pypi.org/project/pytablericons)
[![Python](https://img.shields.io/badge/python-3.7+-blue)](https://github.com/niklashenning/pytablericons)
[![Build](https://img.shields.io/badge/build-passing-neon)](https://github.com/niklashenning/pytablericons)
[![Coverage](https://img.shields.io/badge/coverage-100%25-green)](https://github.com/niklashenning/pytablericons)
[![License](https://img.shields.io/badge/license-MIT-green)](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
<p align="center">
<a href="https://tabler-icons.io/"><strong>Browse at tabler-icons.io →</strong></a>
</p>
<p align="center">
<img src="https://github.com/niklashenning/pytablericons/assets/58544929/e13fb020-4d5f-4e28-bd5f-0d5659bd6582" alt="pytablericons" width="1009">
</p>
## 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, FilledIcon
icon_rotate = TablerIcons.load(OutlineIcon.ROTATE) # Outline icon
icon_check = TablerIcons.load(FilledIcon.CIRCLE_CHECK) # Filled icon
```
> **NOTE:** <br>The icon names are the same as on the tabler-icons.io site, except every letter is uppercase and hyphens are replaced with underscores.<br>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:** <br>The color can either be a **hex color** or one of very limited **color names**. <br>Examples: `'#ec3440'`, `'#581790'`, `'red'`, `'green'`, `'blue'`
## Examples
- **Using an icon with Pillow:**
```python
from pytablericons import TablerIcons, FilledIcon
icon = 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, OutlineIcon
class 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 (<!--icons-count-outline-->4577<!--/icons-count-outline--> icons)
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-outline-dark.png">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-outline.png">
<img src="https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-outline.png" alt="Tabler Icons preview" width="838">
</picture>
</p>
### Filled version (<!--icons-count-filled-->660<!--/icons-count-filled--> icons)
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-filled-dark.png">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-filled.png">
<img src="https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-filled.png" alt="Tabler Icons preview" width="838">
</picture>
</p>
## 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).
Raw data
{
"_id": null,
"home_page": "https://github.com/niklashenning/pytablericons",
"name": "pytablericons",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "python, icon, icons, svg, tabler-icons",
"author": "Niklas Henning",
"author_email": "business@niklashenning.com",
"download_url": "https://files.pythonhosted.org/packages/4a/74/44204d02a35ad5e2c47d9f866a583da7d9ff8e3bd151af820e893b12355e/pytablericons-1.0.0.tar.gz",
"platform": null,
"description": "\r\n# pytablericons\r\n\r\n[![PyPI](https://img.shields.io/badge/pypi-v1.0.0-blue)](https://pypi.org/project/pytablericons)\r\n[![Python](https://img.shields.io/badge/python-3.7+-blue)](https://github.com/niklashenning/pytablericons)\r\n[![Build](https://img.shields.io/badge/build-passing-neon)](https://github.com/niklashenning/pytablericons)\r\n[![Coverage](https://img.shields.io/badge/coverage-100%25-green)](https://github.com/niklashenning/pytablericons)\r\n[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/niklashenning/pytablericons/blob/master/LICENSE)\r\n\r\nPython 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\r\n\r\n<p align=\"center\">\r\n <a href=\"https://tabler-icons.io/\"><strong>Browse at tabler-icons.io →</strong></a>\r\n</p>\r\n\r\n<p align=\"center\">\r\n <img src=\"https://github.com/niklashenning/pytablericons/assets/58544929/e13fb020-4d5f-4e28-bd5f-0d5659bd6582\" alt=\"pytablericons\" width=\"1009\">\r\n</p>\r\n\r\n## Features\r\n- 5237 free MIT-licensed high-quality SVG icons\r\n- Load icons into Pillow Image with custom size, color, and stroke width\r\n- Supports IDE autocompletion\r\n- Works cross-platform without any extra dependencies\r\n- Easy to use with `Pillow`, `PyQt5`, `PyQt6`, `PySide2`, `PySide6`, `Tkinter`, etc.\r\n\r\n## Installation\r\n```python\r\npip install pytablericons\r\n```\r\n\r\n## Usage\r\nImport `TablerIcons` and call the static `load()` method with the desired `OutlineIcon` or `FilledIcon`:\r\n```python\r\nfrom pytablericons import TablerIcons, OutlineIcon, FilledIcon\r\n\r\nicon_rotate = TablerIcons.load(OutlineIcon.ROTATE) # Outline icon\r\nicon_check = TablerIcons.load(FilledIcon.CIRCLE_CHECK) # Filled icon\r\n```\r\n\r\n> **NOTE:** <br>The icon names are the same as on the tabler-icons.io site, except every letter is uppercase and hyphens are replaced with underscores.<br>Examples: `rotate` → `ROTATE`, `arrow-down-right` → `ARROW_DOWN_RIGHT`\r\n\r\n## Customization\r\nSetting a custom size, color, and stroke width:\r\n```python\r\n# Width and height 100px (default: 24)\r\nicon_custom_size = TablerIcons.load(OutlineIcon.ROTATE, size=100)\r\n\r\n# Color red (default: '#FFF')\r\nicon_custom_color = TablerIcons.load(OutlineIcon.ROTATE, color='#ff0000')\r\n\r\n# Stroke width 1.5 (default: 2.0)\r\nicon_custom_stroke_width = TablerIcons.load(OutlineIcon.ROTATE, stroke_width=1.5)\r\n\r\n# Combining everything\r\nicon_custom = TablerIcons.load(OutlineIcon.ROTATE, size=100, color='#ff0000', stroke_width=1.5)\r\n```\r\n\r\n> **NOTE:** <br>The color can either be a **hex color** or one of very limited **color names**. <br>Examples: `'#ec3440'`, `'#581790'`, `'red'`, `'green'`, `'blue'`\r\n\r\n## Examples\r\n\r\n- **Using an icon with Pillow:**\r\n```python\r\nfrom pytablericons import TablerIcons, FilledIcon\r\n\r\nicon = TablerIcons.load(FilledIcon.CIRCLE_CHECK) # Load icon\r\nicon.show() # Show icon\r\nprint(icon.size) # Print icon size\r\n```\r\n\r\n- **Using an icon with PyQt6:**\r\n```python\r\nfrom PyQt6.QtGui import QIcon\r\nfrom PyQt6.QtWidgets import QMainWindow, QPushButton\r\nfrom pytablericons import TablerIcons, OutlineIcon\r\n\r\n\r\nclass Window(QMainWindow):\r\n def __init__(self):\r\n super().__init__(parent=None)\r\n \r\n # Load icon\r\n icon_rotate = TablerIcons.load(OutlineIcon.ROTATE, color='#000')\r\n \r\n # Create button with icon\r\n self.button = QPushButton(self)\r\n self.button.setText('Rotate')\r\n self.button.setIcon(QIcon(icon_rotate.toqpixmap()))\r\n```\r\n\r\n- **Using an icon with Tkinter:**\r\n```python\r\nfrom PIL import ImageTk\r\nfrom tkinter import Tk, Button\r\nfrom tkinter.constants import *\r\nfrom pytablericons import TablerIcons, OutlineIcon\r\n\r\n\r\n# Create window\r\nroot = Tk()\r\n\r\n# Load icon and convert to ImageTk\r\nicon_rotate = TablerIcons.load(OutlineIcon.ROTATE, size=16, color='#000', stroke_width=3.0)\r\nicon_rotate_tk_image = ImageTk.PhotoImage(icon_rotate)\r\n\r\n# Create button with icon\r\nbutton = Button(root, text='Rotate', image=icon_rotate_tk_image, compound=LEFT)\r\nbutton.pack(padx=50, pady=25)\r\n\r\n# Run event loop\r\nroot.mainloop()\r\n```\r\n\r\nMore in-depth examples can be found in the [examples](https://github.com/niklashenning/pytablericons/blob/master/examples) folder.\r\n\r\n## Preview\r\n### Outline version (<!--icons-count-outline-->4577<!--/icons-count-outline--> icons)\r\n\r\n<p align=\"center\">\r\n <picture>\r\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-outline-dark.png\">\r\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-outline.png\">\r\n <img src=\"https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-outline.png\" alt=\"Tabler Icons preview\" width=\"838\">\r\n </picture>\r\n</p>\r\n\r\n### Filled version (<!--icons-count-filled-->660<!--/icons-count-filled--> icons)\r\n\r\n<p align=\"center\">\r\n <picture>\r\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-filled-dark.png\">\r\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-filled.png\">\r\n <img src=\"https://raw.githubusercontent.com/tabler/tabler-icons/master/.github/preview/icons-filled.png\" alt=\"Tabler Icons preview\" width=\"838\">\r\n </picture>\r\n</p>\r\n\r\n## Tests\r\nInstalling the required test dependencies [pytest](https://github.com/pytest-dev/pytest) and [coveragepy](https://github.com/nedbat/coveragepy):\r\n```\r\npip install pytest coverage\r\n```\r\n\r\nTo run the tests with coverage, clone this repository, go into the main directory and run:\r\n```\r\ncoverage run -m pytest\r\ncoverage report --ignore-errors -m\r\n```\r\n\r\n## License\r\nThis software is licensed under the [MIT license](https://github.com/niklashenning/pytablericons/blob/master/LICENSE).\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python wrapper for the Tabler Icons library with 5237 high-quality icons",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/niklashenning/pytablericons"
},
"split_keywords": [
"python",
" icon",
" icons",
" svg",
" tabler-icons"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "56dc900206ad030762b8f3d349d9e434ec420a3421f04b8790182f63818511dc",
"md5": "af2b45520755f1f394ab041dafd68cbc",
"sha256": "1156953c0f023634df0f99df069faa6a46391c433e29055b1d45db5203d12e45"
},
"downloads": -1,
"filename": "pytablericons-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "af2b45520755f1f394ab041dafd68cbc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 2692375,
"upload_time": "2024-04-20T10:32:00",
"upload_time_iso_8601": "2024-04-20T10:32:00.162875Z",
"url": "https://files.pythonhosted.org/packages/56/dc/900206ad030762b8f3d349d9e434ec420a3421f04b8790182f63818511dc/pytablericons-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4a7444204d02a35ad5e2c47d9f866a583da7d9ff8e3bd151af820e893b12355e",
"md5": "76f068cc5fa834e0af420daaa1e3c894",
"sha256": "c34cbe5c0664f9f063a647326917bbccbe1dd05621a17ccd2fc30d834805622b"
},
"downloads": -1,
"filename": "pytablericons-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "76f068cc5fa834e0af420daaa1e3c894",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 612531,
"upload_time": "2024-04-20T10:32:07",
"upload_time_iso_8601": "2024-04-20T10:32:07.227650Z",
"url": "https://files.pythonhosted.org/packages/4a/74/44204d02a35ad5e2c47d9f866a583da7d9ff8e3bd151af820e893b12355e/pytablericons-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-20 10:32:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "niklashenning",
"github_project": "pytablericons",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"requirements": [
{
"name": "pygame",
"specs": [
[
">=",
"2.5.2"
]
]
},
{
"name": "Pillow",
"specs": [
[
">=",
"9.5.0"
]
]
}
],
"lcname": "pytablericons"
}