Skip to main content

Django reusable application to handle modern bunch of site icons

Project description

GitHub Coveralls Requires License Version Supported Python version Supported Django version Package format Python wheel support Package status

django-xicon is a Django reusable application to handle a modern bunch of site icons

Nowadays <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" sizes="16x16"/> is not enough for good site or web application. Apple, Microsoft and Google creates their own standards. django-xicon solve the boring problem of reading and implementing of these standards requirements through fast and simple Django project configuration. These standards requirements are not fully implemented, but enough to pass most of the checks.

Installation

  • Obtain your copy of source code from the git repository: $ git clone https://github.com/vint21h/django-xicon.git. Or download the latest release from https://github.com/vint21h/django-xicon/tags/.

  • Run $ python ./setup.py install from the repository source tree or unpacked archive. Or use pip: $ pip install django-xicon.

Configuration

  • Add "xicon" to settings.INSTALLED_APPS:

# settings.py

INSTALLED_APPS += [
    "xicon",
]
  • Add "xicon" to your URLs definitions if you want to serve manifest.json or browserconfig.xml:

# urls.py

from django.urls import include, re_path


urlpatterns += [
    re_path(r"^xicon/", include("xicon.urls")),
]

Settings

XICON_FAVICONS

Contains list of favicons. Defaults to []. Each element must be according to the next structure:

{
    "src": "favicon.ico",  # type: str
    "type": "image/x-icon",  # type: str
    "size": "16x16",  # type: Optional[str]
}

Where src key is a path to the favicon file in Django static directory, type is favicon file mime-type and size key contains icon’s width and height and can be omitted.

XICON_APPLE_TOUCH_ICONS

Contains list of apple touch icons. Defaults to []. Each element must be according to the next structure:

{
    "src": "apple-touch-icon-144x144.png",  # type: str
    "size": "144x144",  # type: Optional[str]
}

Where src key is a path to the icon file in Django static directory and size contains icon’s width and height and can be omitted.

XICON_APPLE_TOUCH_ICON_MASK_ICON_SRC

Contains path to Safari pinned tabs icon. Defaults to "".

XICON_APPLE_TOUCH_ICON_MASK_ICON_COLOR

Contains path to Safari pinned tab icon hover color. Defaults to "", must start with #.

XICON_APPLE_MOBILE_WEB_APP_STATUS_BAR_STYLE_COLOR

Contains iOS web application status bar color. Defaults to "".

XICON_APPLE_MOBILE_WEB_APP_TITLE

Contains iOS web application launch icon title. Defaults to "".

XICON_ANDROID_CHROME_THEME_COLOR

Contains android chrome web application toolbar color also used in manifest.json. Defaults to "", must start with #.

XICON_ANDROID_CHROME_ICONS

Contains a list of icons for manifest.json. Defaults to []. Each element must be according to the next structure:

{
    "src": "android-chrome-64x64.png",  # type: str
    "type": "image/png",  # type: str
    "sizes": "64x64",  # type: str
}

Where src key is a path to the icon file in Django static directory, type is favicon file mime-type and size key contains icon’s width and height.

XICON_ANDROID_CHROME_NAME

Contains android chrome web application name for manifest.json. Defaults to "".

XICON_ANDROID_CHROME_SHORT_NAME

Contains android chrome web application short name for manifest.json. Defaults to "".

XICON_ANDROID_CHROME_BACKGROUND_COLOR

Contains android chrome web application background color for manifest.json. Defaults to "", must start with #.

XICON_ANDROID_CHROME_DISPLAY

Contains android chrome web application browser UI mode for manifest.json. Defaults to "".

XICON_ANDROID_CHROME_ORIENTATION

Contains android chrome web application screen orientation for manifest.json. Defaults to "".

XICON_MSAPPLICATION_NAME

Contains microsoft application name. Defaults to "".

XICON_MSAPPLICATION_TILE_COLOR

Contains Microsoft application tile color also used in browserconfig.xml. Defaults to "", must start with #.

XICON_MSAPPLICATION_TILES

Contains list of icons for Microsoft application meta tags and also used in browserconfig.xml. Defaults to []. Each element must be according to the next structure:

{
    "src": "mstile-70x70.png",  # type: str
    "name": "square70x70logo",  # type: str
}

Where src key is a path to the icon file in Django static directory and name contains tile name (type).

Usage

If you want to use all power of django-xicon, just set up all settings and include "xicon/includes/xicon.html" to your base template <head> HTML tag:

{# base.html #}

<head>
    {% include "xicon/includes/xicon.html" %}
</head>

Or just for favicons, setup XICON_FAVICONS setting, load "xicon_tags" to your base template and place "xicon_favicons" in <head> HTML tag:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_favicons %}
</head>

If you want to setup web application for apple devices, setup all settings prefixed with XICON_APPLE_ and include "xicon/includes/apple.html" to your base template <head> HTML tag:

{# base.html #}

<head>
    {% include "xicon/includes/apple.html" %}
</head>

Or just for apple touch icons, setup APPLE_TOUCH_ICONS setting, load "xicon_tags" to your base template and place "xicon_apple_touch_icons" in <head> HTML tag:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_apple_touch_icons %}
</head>

To use Safari pinned tabs mask icon setup XICON_APPLE_TOUCH_ICON_MASK_ICON_SRC and XICON_APPLE_TOUCH_ICON_MASK_ICON_COLOR settings, load "xicon_tags" to your base template and place "xicon_apple_touch_icon_mask_icon" in <head> HTML tag:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_apple_touch_icon_mask_icon %}
</head>

To configure iOS web application bar style color setup XICON_APPLE_MOBILE_WEB_APP_STATUS_BAR_STYLE_COLOR setting, load "xicon_tags" to your base template and place "xicon_apple_mobile_web_app_status_bar_style" in <head> HTML tag:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_apple_mobile_web_app_status_bar_style %}
</head>

To configure iOS web application launch icon title setup XICON_APPLE_MOBILE_WEB_APP_TITLE setting, load "xicon_tags" to your base template and place "xicon_apple_mobile_web_app_title" in <head> HTML tag:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_apple_mobile_web_app_title %}
</head>

If you want to use android chrome related things, just setup all settings prefixed with XICON_ANDROID_CHROME_ and include "xicon/includes/android-chrome.html" to your base template <head> HTML tag:

{# base.html #}

<head>
    {% include "xicon/includes/android-chrome.html" %}
</head>

Or if you need only configure android chrome web application toolbar color, setup XICON_ANDROID_CHROME_THEME_COLOR, load "xicon_tags" to your base template and place "xicon_android_chrome_theme_color" in <head> HTML tag:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_android_chrome_theme_color %}
</head>

If you need generate and serve manifest.json, add "xicon" to your URLs definitions, setup next settings: XICON_ANDROID_CHROME_THEME_COLOR, XICON_ANDROID_CHROME_ICONS, XICON_ANDROID_CHROME_NAME, XICON_ANDROID_CHROME_SHORT_NAME, XICON_ANDROID_CHROME_BACKGROUND_COLOR, XICON_ANDROID_CHROME_DISPLAY and XICON_ANDROID_CHROME_ORIENTATION`, and then include "xicon/includes/android-chrome-manifest-meta.html" to your base template <head> HTML tag:

# urls.py

from django.urls import include, re_path


urlpatterns += [
    re_path(r"^xicon/", include("xicon.urls")),
]
{# base.html #}

<head>
    {% include "xicon/includes/android-chrome-manifest-meta.html" %}
</head>

If you want to setup microsoft application configure all settings prefixed with XICON_MSAPPLICATION_ and include "xicon/includes/msapplication.html" to your base template <head> HTML tag:

{# base.html #}

<head>
    {% include "xicon/includes/msapplication.html" %}
</head>

Or if you need only configure microsoft application name, setup XICON_MSAPPLICATION_NAME, load "xicon_tags" to your base template and place "xicon_msapplication_name" in <head> HTML tag of your base template:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_msapplication_name %}
</head>

If you need configure microsoft application tile color, setup XICON_MSAPPLICATION_TILE_COLOR, load "xicon_tags" to your base template and place "xicon_msapplication_tile_color" in <head> HTML tag of your base template:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_msapplication_tile_color %}
</head>

If you need generate and serve browserconfig.xml, add "xicon" to your URLs definitions, setup next settings: XICON_MSAPPLICATION_TILE_COLOR and XICON_MSAPPLICATION_TILES, and then include "xicon/includes/msapplication-browserconfig-meta.html" to your base template <head> HTML tag:

# urls.py

from django.urls import include, re_path


urlpatterns += [
    re_path(r"^xicon/", include("xicon.urls")),
]
{# base.html #}

<head>
    {% include "xicon/includes/msapplication-browserconfig-meta.html" %}
</head>

Or just for microsoft application tiles, setup MSAPPLICATION_TILES setting, load "xicon_tags" to your base template and place "xicon_mstiles" in <head> HTML tag:

{# base.html #}

{% load xicon_tags %}

<head>
    {% xicon_mstiles %}
</head>

Licensing

django-xicon is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For complete license text see COPYING file.

Contacts

Project Website: https://github.com/vint21h/django-xicon/

Author: Alexei Andrushievich <vint21h@vint21h.pp.ua>

For complete authors list see AUTHORS file.

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

django-xicon-0.14.25.zip (44.7 kB view details)

Uploaded Source

Built Distribution

django_xicon-0.14.25-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file django-xicon-0.14.25.zip.

File metadata

  • Download URL: django-xicon-0.14.25.zip
  • Upload date:
  • Size: 44.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for django-xicon-0.14.25.zip
Algorithm Hash digest
SHA256 8df89139908130df90201caeee246ac4e6fc175811b1d59c163c651b0b9d04f0
MD5 b9d8609de0434aa73dff741aa50ba2e0
BLAKE2b-256 0c36717b22efa8a09376c1c58e0b8a28cbb1e2f62fa7c7f506008b0455c58f45

See more details on using hashes here.

File details

Details for the file django_xicon-0.14.25-py3-none-any.whl.

File metadata

  • Download URL: django_xicon-0.14.25-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for django_xicon-0.14.25-py3-none-any.whl
Algorithm Hash digest
SHA256 0d8c380c97abc794d65040e152a308cabceb9973c9399f11c51e688306373981
MD5 04828beb505e69731fa47674aa901a15
BLAKE2b-256 c90b19548946bd82cd6e46a6114d8b935c3215ebdbbc520ee7489d5533249139

See more details on using hashes here.

Supported by

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