django-spectrum


Namedjango-spectrum JSON
Version 0.5.3 PyPI version JSON
download
home_pagehttps://github.com/dldevinc/django-spectrum
SummaryProvides a colorpicker field for Django
upload_time2023-08-18 05:40:51
maintainerMihail Mishakin
docs_urlNone
authorMihail Mishakin
requires_python>=3.6
licenseBSD license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-spectrum

Provides a colorpicker field for Django

![image](https://user-images.githubusercontent.com/6928240/170836333-eb125dac-e617-44d3-9f3b-eefa8501b373.png)

[![PyPI](https://img.shields.io/pypi/v/django-spectrum.svg)](https://pypi.org/project/django-spectrum/)
[![Build Status](https://travis-ci.com/dldevinc/django-spectrum.svg?branch=master)](https://travis-ci.org/dldevinc/django-spectrum)

## Compatibility

-   `python` >= 3.6
-   `django` >= 1.11

## Quickstart

Install `django-spectrum`:

```bash
pip install django-spectrum
```

Add it to your `INSTALLED_APPS` list:

```python
INSTALLED_APPS = (
    ...
    "spectrum",
)
```

Then add it to your models:

```python
from django.db import models
from spectrum.fields import ColorField

class MyModel(models.Model):
    color = ColorField(_("color"), default="#FFFF00")
```

## Color class

The module defines a `Color` class which is used to represent the `ColorField`
attribute on the model. The `Color` class can also be used standalone without
any Django model.

Some examples of funcionality provided by the `Color` class:

```python
from spectrum.color import Color

c = Color("#FFDA0080")

>>> print(c.red)
255

>>> print(c.alpha)
128

>>> print(c.hex)
#FFDA00

>>> print(c.hexa)
#FFDA0080

>>> print(c.rgb)
rgb(255, 218, 0)

>>> print(c.rgba)
rgba(255, 218, 0, 0.5)

>>> print(c.opacity)
0.5

>>> print(c.as_tuple())
(255, 218, 0, 128)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dldevinc/django-spectrum",
    "name": "django-spectrum",
    "maintainer": "Mihail Mishakin",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "x896321475@gmail.com",
    "keywords": "",
    "author": "Mihail Mishakin",
    "author_email": "x896321475@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/95/1d/7deeb5f2f106bc1b2008ba4ec1028f5338ffda1cd266572f46873644f75e/django-spectrum-0.5.3.tar.gz",
    "platform": "OS Independent",
    "description": "# django-spectrum\n\nProvides a colorpicker field for Django\n\n![image](https://user-images.githubusercontent.com/6928240/170836333-eb125dac-e617-44d3-9f3b-eefa8501b373.png)\n\n[![PyPI](https://img.shields.io/pypi/v/django-spectrum.svg)](https://pypi.org/project/django-spectrum/)\n[![Build Status](https://travis-ci.com/dldevinc/django-spectrum.svg?branch=master)](https://travis-ci.org/dldevinc/django-spectrum)\n\n## Compatibility\n\n-   `python` >= 3.6\n-   `django` >= 1.11\n\n## Quickstart\n\nInstall `django-spectrum`:\n\n```bash\npip install django-spectrum\n```\n\nAdd it to your `INSTALLED_APPS` list:\n\n```python\nINSTALLED_APPS = (\n    ...\n    \"spectrum\",\n)\n```\n\nThen add it to your models:\n\n```python\nfrom django.db import models\nfrom spectrum.fields import ColorField\n\nclass MyModel(models.Model):\n    color = ColorField(_(\"color\"), default=\"#FFFF00\")\n```\n\n## Color class\n\nThe module defines a `Color` class which is used to represent the `ColorField`\nattribute on the model. The `Color` class can also be used standalone without\nany Django model.\n\nSome examples of funcionality provided by the `Color` class:\n\n```python\nfrom spectrum.color import Color\n\nc = Color(\"#FFDA0080\")\n\n>>> print(c.red)\n255\n\n>>> print(c.alpha)\n128\n\n>>> print(c.hex)\n#FFDA00\n\n>>> print(c.hexa)\n#FFDA0080\n\n>>> print(c.rgb)\nrgb(255, 218, 0)\n\n>>> print(c.rgba)\nrgba(255, 218, 0, 0.5)\n\n>>> print(c.opacity)\n0.5\n\n>>> print(c.as_tuple())\n(255, 218, 0, 128)\n```\n",
    "bugtrack_url": null,
    "license": "BSD license",
    "summary": "Provides a colorpicker field for Django",
    "version": "0.5.3",
    "project_urls": {
        "Homepage": "https://github.com/dldevinc/django-spectrum"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b552d9f999a39ee0010d1257e1bc1c8b1460560e4b2a7f9a3dc30402fb568987",
                "md5": "77bcadaec83b828f02d2180c11e16fd7",
                "sha256": "5ebb24295dbff26c7560fed64ea5ef359733ebb3d8d90b6da0b1ad30741b4ad4"
            },
            "downloads": -1,
            "filename": "django_spectrum-0.5.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "77bcadaec83b828f02d2180c11e16fd7",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 124373,
            "upload_time": "2023-08-18T05:40:50",
            "upload_time_iso_8601": "2023-08-18T05:40:50.140605Z",
            "url": "https://files.pythonhosted.org/packages/b5/52/d9f999a39ee0010d1257e1bc1c8b1460560e4b2a7f9a3dc30402fb568987/django_spectrum-0.5.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "951d7deeb5f2f106bc1b2008ba4ec1028f5338ffda1cd266572f46873644f75e",
                "md5": "de404c4686aea560008bd3011b6c3358",
                "sha256": "52fd2f3d7e89a84e6904914fdb76539fd401aa0ff1f934a4d64065835a0324e2"
            },
            "downloads": -1,
            "filename": "django-spectrum-0.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "de404c4686aea560008bd3011b6c3358",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 122205,
            "upload_time": "2023-08-18T05:40:51",
            "upload_time_iso_8601": "2023-08-18T05:40:51.869613Z",
            "url": "https://files.pythonhosted.org/packages/95/1d/7deeb5f2f106bc1b2008ba4ec1028f5338ffda1cd266572f46873644f75e/django-spectrum-0.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-18 05:40:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dldevinc",
    "github_project": "django-spectrum",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "django-spectrum"
}
        
Elapsed time: 0.11687s