Code Monkey home page Code Monkey logo

django-octicons's Introduction

django-octicons

PyPI Build Status Python Versions License

Django template tags for using GitHub Octicons, with no other dependencies.

Installation

Grab it from PyPI using pipenv (or pip):

$ pipenv install django-octicons

Install the app in your project:

# settings.py

INSTALLED_APPS = [
    # other apps
    'octicons',
]

Usage

Load the tag library in your HTML template:

{% load octicons %}

And then, you can use the icons like this:

<a class="btn btn-sm" href="#url" role="button">
  {% octicon "eye" %}
  Watch
</a>

You can also pass required height and width for the icon like this:

<a class="btn btn-sm" href="#url" role="button">
  {% octicon "thumbsup" height="60" width="60" class="large" %}
  Confirm Purchase
</a>

Or, you can scale the icon with respect to its default dimensions like this:

<a class="btn btn-sm" href="#url" role="button">
  {% octicon "thumbsup" scale=2 class="large" %}
  Confirm Purchase
</a>

All attributes passed will be added as HTML attributes to the SVG element of the icon.

Styling

You should add the following in your styles:

.octicon {
  display: inline-block;
  vertical-align: text-top;
  fill: currentColor;
}

The class octicon will be present in all icons. You are free to style it however you want.

django-octicons's People

Contributors

sanketsaurav avatar sauravsrijan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-octicons's Issues

Ability to register new icons

In addition to the default set of Octicons, there should be a way to register new SVG icons. Using the new icons should be identical to how default icons are used.

Version of octicons ?

What's the version of octicons that's shipping with this package ?
Would it be possible to update it to latest ? Thanks a lot.

Accept a `scale` argument in the tag

The template tag currently accepts width and height arguments which help scale the icon arbitrarily. In addition to this, accept a scale argument that adjusts the width and height proportionately w.r.t. the original size.

The behaviour should be something like this:

<!-- should scale the default icon by a factor of 1.5 -->
{% octicon "thumbsup" scale="1.5" %}

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.