Skip to main content

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:

Release files for Flask-Colorpicker 0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Colorpicker 0.11
File Size Uploaded
flask_colorpicker-0.11.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Colorpicker 0.11
File Interpreter ABI Platform
flask_colorpicker-0.11-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / flask_colorpicker-0.11.tar.gz

Download URL flask_colorpicker-0.11.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fbb56ed68ef10e7d56e987c86a58e04608a205ffa45914297d357bdaea512539
BLAKE2b-256 checksum
How to use checksums
923e09e641a4c2b174d09562bcd3630a562ad10af5ba9be77c98f1e5e4edce14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / flask_colorpicker-0.11-py3-none-any.whl

Download URL flask_colorpicker-0.11-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
099f074cdd2388868937c0d6d2176c47eb98d4663e347674bce0eb765600e0cc
BLAKE2b-256 checksum
How to use checksums
5f0bc3a0687c4cd76f39834daebdc5659fa98b7c077bd762804def7e115470ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.11 This release

2 release files

0.10

2 release files

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page