Skip to content
fujaru edited this page Jan 1, 2016 · 5 revisions

Installation

Installing Wheel Color Picker plugin is pretty straightforward! First, you should already have downloaded this plugin and, of course, jQuery library. If not, download them here:

Now you have them in your hands.

First, extract Wheel Color Picker archive to anywhere in your website directory. You might want to put them this way:

  1. jquery.wheelcolorpicker.js to be placed inside /js/
  2. css/* files to be placed inside /css/
  3. Other than those js file and css dir, you can discard them.

Usage

Second, on your html page, add these lines to the <head> section:

    <link type="text/css" rel="stylesheet" href="path/to/css/wheelcolorpicker.css" />
    <script type="text/javascript" src="path/to/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="path/to/js/jquery.wheelcolorpicker.js"></script>

If your website has dark color scheme, you may wish to use wheelcolorpicker.dark.css file instead of wheelcolorpicker.css

Create an input element. Add data-wheelcolorpicker attribute to attach a color picker when user focus the input.

    <input type="text" name="color" id="ColorInput" value="#ff0000" data-wheelcolorpicker />

For version 2.2 or earlier

Add the following javascript code to attach a color picker to the input element (commonly in <head> section):

    $(function() {
        $('#ColorInput').wheelColorPicker();
    });

That's it!

Performance Tweak

If you are targeting lower-end devices, it is possible to speed up performance by reducing quality or completely disable dynamic slider gradients.

$(function() {
    $('#ColorInput').wheelColorPicker({
        quality: 0.2, // Reduce gradient details to the lowest acceptable value
        live: false // Disable dynamic slider gradients
    });
});