Skip to main content

Python Wrapper for the simpleicons (https://simpleicons.org) library

Project description

simplepycons

PyPI Simple Icons version License pdm-managed

Python wrappers for simple-icons inspired by the wonderful work of sachinraja.

As latter project seems to be no longer maintained, this project starts as being compatible to simple-icons 13.x

Usage

The simplepycons namespace contains the following types:

  • Icon: The basic icon class, from which all Icons are inherited. It is abstract and hence cannot be inherited.
  • all_icons: A collection of all icons found.
  • IconFactory: A simple wrapper providing a callable interface and a prototype.

as well as a class for each icon provided.

So, you can run:

from simplepycons import all_icons, PythonIcon

icon1 = PythonIcon()
icon2 = all_icons.get_python_icon()
icon3 = all_icons["python"]

All calls should provide a new Icon instance of the python icon.

For all simple-icons, a get icon method is provided using the name of the icon.

An instance of Icon offers the following properties:

  • name (str): The name of the icon, i.e. the name of the simple-icon id.
  • original_file_name (str): The name of the file it was created from.
  • title (str): The name of the brand
  • primary_color (str): The primary color of the brand.
  • raw_svg (str): The RAW SVG graphics as string.
  • guidelines_url (str | None): The url to the usage guidelines (optional).
  • license (tuple[str | None, str | None]): The license as a tuple. The first element is the SPDX identifier, the second element is the URL to the license document (optional).
  • source (str): The source URL of the icon.
  • aliases (Iterable[str]): A list of aliases used as alternative titles

An instance of Icon offers the following methods:

  • svg_tree() (xml.ElementTree.Element): The SVG as XML Element
  • customize_svg(**svg_attr: str) (xml.ElementTree.Element): The SVG with custom attributes on the root node.
  • customize_svg_as_bytes(**svg_attr: str) (bytes): The SVG with custom attributes on the root node, converted to a bytes object.
  • customize_svg_as_str(**svg_attr: str) (str): The SVG with custom attributes on the root node, converted to string.
  • customize_svg_as_data_url_(**svg_attr: str) (str): The SVG with custom attributes on the root node, converted to a base64 encoded data url.

The svg_attr keyword arguments can be used to add any arbitrary svg attribute to the SVG root node. If fill is not used, the primary_color is used.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simplepycons-1!15.11.0.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplepycons-1!15.11.0-py3-none-any.whl (5.2 MB view details)

Uploaded Python 3

File details

Details for the file simplepycons-1!15.11.0.tar.gz.

File metadata

  • Download URL: simplepycons-1!15.11.0.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.6 CPython/3.13.6 Linux/6.11.0-1018-azure

File hashes

Hashes for simplepycons-1!15.11.0.tar.gz
Algorithm Hash digest
SHA256 7d6526f2040132bd2c6c0a6ffd4ed893bb47fde1c276cfe8363622c00546b349
MD5 4b3600c77ab9b38fba98501a26fed25c
BLAKE2b-256 621ee828d9e8dde5675186f5a871dad351e2fd086ed70f5e1926c3c5a517c342

See more details on using hashes here.

File details

Details for the file simplepycons-1!15.11.0-py3-none-any.whl.

File metadata

  • Download URL: simplepycons-1!15.11.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.6 CPython/3.13.6 Linux/6.11.0-1018-azure

File hashes

Hashes for simplepycons-1!15.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b61ab1e8f4c88c79f4fd695c97a8bce47292f62dce10784cf98dd8ad9559f2
MD5 0c9e894fe65c8534fd0b6f4b8bfb59bd
BLAKE2b-256 9db31d6d90420f5881d78f464144040e17eadef2c1fd14fd859e023917205900

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page