Skip to main content

Django templatetags for GitHub Octicons v10.0.0.

Project description

django-octicons-v10

GitHub Travis (.org) PyPI PyPI - Python Version

Django templatetags for GitHub Octicons v10.0.0.

This library aims to provide a similar interface to the official JavaScript and Ruby octicon libraries provided by GitHub, but as Django templatetags.

django-octicons is a library that already does this, but currently for an older version of octicons.

Installation

Install the latest version:

pip3 install django-octicons-v10

Place octicons_v10 into your installed apps:

INSTALLED_APPS = [
    # blah, blah, other apps...
    "octicons_v10",
]

Usage

Load the octicons tag library in your Django template:

{% load octicons %}

Use template tags where you want to place an Octicon:

{% octicon "git-branch" %}

Classes

You can pass classes to your shiny new octicon:

<a class="btn">
    {% octicon "git-branch" class="text-purple" %}
    Branches
</a>

Note: The following classes are assigned to the octicon by default:

  • octicon
  • octicon-{ICON_NAME}, for example octicon-git-branch

Sizing

You can pass width or height or both for your desired size:

<a href="#" class="Header-link">
    {% octicon "mark-github" width="32" %}
    GitHub
</a>

If only width or height is passed, then the other scales accordingly.

Note: The default size is 16px by 16px.

16px and 24px variants

The icon variant chosen is dependent on the size specified. If either your width or height is more than 16, then the 24px variant will be chosen.

What if I want to specify a variant regardless of size?

If say, you wanted a 32 width icon, but wanted to use the 16px variant, you can do so by specifying the whole variant name, in the form {ICON_NAME}-{ICON_SIZE}:

{% octicon "alert-16" width="32" %}

Project details


Download files

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

Source Distribution

django-octicons-v10-1.1.0.tar.gz (66.1 kB view details)

Uploaded Source

File details

Details for the file django-octicons-v10-1.1.0.tar.gz.

File metadata

  • Download URL: django-octicons-v10-1.1.0.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for django-octicons-v10-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7c5dad29608dbd79de88ef6f40c618297b63c5cbcf957309485fabdb4f5e9b28
MD5 455edf63f2359cbe46f2ebef5a353ae6
BLAKE2b-256 216401c0d5d5f82fa761d4c6647b0b730d44740034605dbb5d94cedab1b9b86f

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