Skip to content

tahv/tablerpy

Repository files navigation

tablerpy

PyPI - Version PyPI - Python Version License CI - Tests

Tabler Icons library for Python.

Tabler Icons is a set of free MIT-licensed high-quality SVG icons. Each icon is designed on a 24x24 grid and a 2px stroke.

Browse at tabler.io/icons →

Installation

pip install tablerpy

Usage

The function tablerpy.get_icon accepts a OutlineIcon | FilledIcon and return a Traversable (pathlib.Path) to the icon .svg file.

from tablerpy import OutlineIcon, FilledIcon, get_icon

outline_icon_path = get_icon(OutlineIcon.BRAND_GITHUB)
filled_icon_path = get_icon(FilledIcon.BRAND_GITHUB)

Icon names match those on tabler.io/icons, except they are uppercased and hyphens - are replaced with underscores _. For example, brand-github becomes BRAND_GITHUB.

Contributing

Generating icons and enums

To keep up with Tabler Icons releases, most of this package is generated using a script.

$ python scripts/generator.py --help
usage: generator.py [-h] --version VERSION [--package PACKAGE]

Download Tabler Icons release from github.com/tabler/tabler-icons and generate Python files.

options:
  -h, --help         show this help message and exit
  --version VERSION  Tabler Icons release version
  --package PACKAGE  Target package directory

For instance, to generate files from Tabler Icons Release 3.29.0:

python scripts/generator.py --version 3.29.0

Acknowledgements

  • pytablericons for providing inspiration. The package include features for using icons with Pillow, PyQt or PySide.