Coder Social home page Coder Social logo

trellixvulnteam / django-octicons-v10_6wk3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jaynewey/django-octicons-v10

0.0 0.0 0.0 181 KB

Django templatetags for GitHub Octicons v10.0.0+.

Home Page: https://pypi.org/project/django-octicons-v10/

License: MIT License

Python 100.00%

django-octicons-v10_6wk3's Introduction

django-octicons-v10

GitHub .github/workflows/main.yml PyPI PyPI - Python Version Downloads

Octicons cover

Django templatetags for GitHub Octicons v10.0.0+.

Current version v4.1.0 supports Octicons v16.1.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" %}

Keywords

Octicons provides a list of keywords for each icon. You can get an Octicon instance's keywords by accessing its keywords attribute:

>>> octicon = Octicon("octoface")
>>> octicon.keywords
['octocat', 'brand']

When using the GitHub logos, be sure to follow the GitHub logo guidelines.

Issues

Please use the GitHub issue tracker to track issues.

Contributing

Contributions are welcome. Please send a pull request through and explain the reasoning behind the change.

Building

To automatically pull the latest versions of octicons, run:

python3 scripts/build/build.py build octicons_v10/templatetags

In the root folder of the repository.

django-octicons-v10_6wk3's People

Contributors

jaynewey avatar apollo13 avatar dylanjw avatar trellixvulnteam avatar patchtester avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.