Skip to main content

color picker flask extension

Project description

flask_colorpicker

A Flask extension to add Spectrum jQuery color picker into the template, it makes adding and configuring multiple color pickers at a time much easier and less time consuming.

Install :

- With pip:

  • pip install Flask-Colorpicker

- From the source:

  • git clone https://github.com/mrf345/flask_colorpicker.git
  • cd flask_colorpicker
  • python setup.py install

Setup :

- Inside the Flask app:

from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_colorpicker import colorpicker
app = Flask(__name__)
Bootstrap(app)
colorpicker(app)

- inside the jinja template

{% extends 'bootstrap/base.html' %}
{% block scripts %}
  {{ super() }}
  {{ colorpicker.loader() }}
  {{ colorpicker.picker(ids=[".cp"]) }}
{% endblock %}
{% block content %}
  <form class="verticalform">
    <input type="text" class="form-control cp" />
  </form>
{% endblock %}

Settings:

- Customize:

The accepted arguments to be passed to the colorpicker.picker() function are as follow:

def picker(self, ids=[".colorpicker"], # list of ids of element to assign colorpicker to
            default_color='rgb(0,0,255,0.5)', # default color to start with
            color_format='rgb', # color format to use
            showAlpha='true', # enable or disable transparency
            showInput='false', # display or hide color picker
            showButtons='false', # display or hide buttons
            allowEmpty='true'): # allow empty input

- Local source:

by default the extension will load spectrum plugin from a remote CDN. Although you can configure that to be locally through passing a list of two files .js and .css into the colorpicker module like such:

colorpicker(app=app, local=['static/js/spectrum.js', 'static/css/spectrum.css'])

The order in-which the items of list are passed is not of importance, it will be auto detected via file extension

Credit:

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

flask_colorpicker-0.11.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_colorpicker-0.11-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file flask_colorpicker-0.11.tar.gz.

File metadata

  • Download URL: flask_colorpicker-0.11.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for flask_colorpicker-0.11.tar.gz
Algorithm Hash digest
SHA256 fbb56ed68ef10e7d56e987c86a58e04608a205ffa45914297d357bdaea512539
MD5 c29d84a45a11ed73e72cfd9990637518
BLAKE2b-256 923e09e641a4c2b174d09562bcd3630a562ad10af5ba9be77c98f1e5e4edce14

See more details on using hashes here.

File details

Details for the file flask_colorpicker-0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_colorpicker-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 099f074cdd2388868937c0d6d2176c47eb98d4663e347674bce0eb765600e0cc
MD5 9810e41bfbe9df46e29acdb2bf095d2e
BLAKE2b-256 5f0bc3a0687c4cd76f39834daebdc5659fa98b7c077bd762804def7e115470ac

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