User tests: Successful: Unsuccessful:
Tracker item: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=30297
Changed MooTools based color picker (MooRainbow) to a jQuery/Bootstrap based colorpicker (MiniColors).
You can see an example on http://labs.abeautifulsite.net/jquery-miniColors
There are some big advantages to this MiniColors script over the MooRainbow script:
MiniColors comes with 4 types of controls: hue (default), saturation, brightness or wheel.
You can select these via the control attribute in the xml tag, like control="wheel".
Add these fields to the settings part of an xml file of some extension, like a module. Then go to that extensions settings in the admin and test the different color fields.
<field name="color1" type="color" default="#049cdb" label="Default color field" />
<field name="color2" type="color" default="" label="Empty color field" />
<field name="color3" type="color" default="#46a546" disabled="true" label="Disabled color field" />
<field name="color4" type="color" default="#ffc40d" control="hue" label="Control: Hue (default)" />
<field name="color5" type="color" default="#9d261d" control="saturation" label="Control: Saturation" />
<field name="color6" type="color" default="#f89406" control="brightness" label="Control: Brightness" />
<field name="color7" type="color" default="#7a43b6" control="wheel" label="Control: Wheel" />
All fields that use the color type should work fine with this new script.
The MooRainbow js and css files have been removed from the /media/system folder. So if any 3rd party extensions include these these directly into their code (which they shouldn't anyway), then they would need to change their code.
I implemented the script to use the 'bootstrap' theme that comes with MiniColors.
But I changed a bit of css to make it fit in more with the Joomla 3 Bootstrap styling (prostar). I removed some redundant Bootstrap css, as the admin template already styles the input fields itself. And changed the font of the input field to mono-spaced (looks better for the type of value it contains).
So the css file is not a carbon copy of the stylesheet that comes with MiniColors. This may be important when updating the script/css at a later date.
jQuery MiniColors: A tiny color picker built on jQuery
Copyright Cory LaViska for A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
Dual-licensed under the MIT and GPL Version 2 licenses
There is a 5th control type you can choose: simple
This will trigger a different script and a different type of color select field and picker.
This color picker type can be used for fields where you want to limit the color choices.
You can overrule the standard available colors by adding the colors attribute to the xml field tag, with a comma separated list of rgb colors. The empty color value can be called on by the value 'none'
Add these fields to the settings part of an xml file of some extension, like a module. Then go to that extensions settings in the admin and test the different color fields.
<field name="color8" type="color" default="#049cdb" control="simple" label="Control: Simple" />
<field name="color9" type="color" default="none" control="simple" label="Simple: Empty" />
<field name="color10" type="color" default="none" control="simple" label="Simple: Custom Color List"
colors="none,#FFFFFF,#000000,#FF0000,#00FF00,#0000FF,#00FFFF,#FF00FF,#FFFF00" />
I have based the script for the simple control type on: https://github.com/tkrotoff/jquery-simplecolorpicker
Very simple jQuery Color Picker
Copyright (C) 2012 Tanguy Krotoff
Licensed under the MIT license
However, I changed a lot of stuff in the functionality and styling. Not sure if I have changed enough to call it a fully custom script...
Thanks! We'll let you know if we run into things. Your script - if it gets into Joomla 3 - will get hundred thousands (or even millions) of users. ;)
For others: claviska is the author of the jQuery MiniColors script.
Thanks guys! This looks great! :)
Tracker item added at http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=30297
I added a 5th control type: simple
Which used a different script. See the last section in the markup.
Ok, changed position of the color picker panels to the right :)
Added ability to define color picker panel position by using position="" in xml (right/left/top/bottom).
In html a data-position="..." is added to the form element.
You can test with:
<field name="color11" type="color" default="" position="right" label="Right" />
<field name="color12" type="color" default="" position="left" label="Left" />
<field name="color13" type="color" default="" position="top" label="Top" />
<field name="color14" type="color" default="" position="bottom" label="Bottom" />
<field name="color21" type="color" default="" control="simple" position="right" label="Simple: Right" />
<field name="color22" type="color" default="" control="simple" position="left" label="Simple: Left" />
<field name="color23" type="color" default="" control="simple" position="top" label="Simple: Top" />
<field name="color24" type="color" default="" control="simple" position="bottom" label="Simple: Bottom" />
This looks great. I'm attaching myself to this to follow the thread. I'd love to see it make it's way into Joomla's core. Please let me know if you find any issues with the plugin so we can get them resolved quickly.