? Success

User tests: Successful: Unsuccessful:

avatar renekorss
renekorss
1 Apr 2016

Update color form field type use to latest jQuery minicolor. Adds support for rgba colors with new attributes format and opacity.

How to test

Create two color fields and check if everything works like expected.

Expected: results in hex color and hasn't opacity picker.

<field
    name="colorhex"
    type="color" />

Expected: results in rgb color and hasn't opacity picker.

<field
    name="colorrgba"
    type="color" 
    format="rgb" />

Expected: results in rgba color and has opacity picker.

<field
    name="colorrgba"
    type="color" 
    format="rgb"
    opacity="0.5" />
avatar renekorss renekorss - open - 1 Apr 2016
avatar renekorss renekorss - change - 1 Apr 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Apr 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 1 Apr 2016
Category External Library JavaScript
avatar brianteeman brianteeman - change - 1 Apr 2016
Category External Library JavaScript External Library Fields JavaScript
avatar andrepereiradasilva
andrepereiradasilva - comment - 2 Apr 2016

This seems a nice change. But some improvements IMHO are needed.
tested the following fields

<field name="colordefault" type="color" />
<field name="colordefaultopacity" type="color" opacity="0.5" />
<field name="colorhex" type="color" format="hex" />
<field name="colorhexopacity" type="color" format="hex" opacity="0.5" />
<field name="colorrgb" type="color"  format="rgb" />
<field name="colorrgbopacity" type="color" format="rgb" opacity="0.5" />
<field name="colorrgba" type="color" format="rgba" />
<field name="colorrgbaopacity" type="color" format="rgba" opacity="0.5" />

result:
image

instead of making the colorpicker only rgba when you add the opacity="" parameter why not make an rgbaformat and drop the opacity (i think it can be setted in the default attribute as others right?).

So we could have this

<field name="colordefault" type="color" />
<field name="colorhex" type="color" format="hex" />
<field name="colorrgb" type="color"  format="rgb" />
<field name="colorrgba" type="color" format="rgba" />
avatar renekorss
renekorss - comment - 2 Apr 2016

Thanks @andrepereiradasilva. Yes, this seems more logical. Although currently there is no default attribute used, I will add it so we can have these options you described. To be clear, colordefault is short for colorhex in your example?

avatar andrepereiradasilva
andrepereiradasilva - comment - 2 Apr 2016

To be clear, colordefault is short for colorhex in your example?

Since the default value for format is hex, yes.

avatar JoomliC
JoomliC - comment - 3 Apr 2016

Hi @renekorss do you know there's already a PR for this?
#7602

In the same, you're not exactly implenting it in joomla as it was meant to be.
I'm currently on holidays, and didn't have enough free time in March, but will do the updated PR when back.
Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9706.

avatar renekorss
renekorss - comment - 3 Apr 2016

Hi @JoomliC. Sorry, didn't notice that. Closing this in favor of your PR. Hope you will get it ready soon. :) Thanks!

avatar renekorss renekorss - change - 3 Apr 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-04-03 09:16:11
Closed_By renekorss
avatar renekorss renekorss - close - 3 Apr 2016
avatar renekorss renekorss - close - 3 Apr 2016
avatar andrepereiradasilva
andrepereiradasilva - comment - 3 Apr 2016

didn't know that too. Great! will wait for @JoomliC PR then.

avatar JoomliC
JoomliC - comment - 29 Apr 2016

@renekorss PR is done: #10129 ! ;-)
As you will see, comparing to my first PR, i have integrated your idea about the placeholder :+1:

What was missing in your PR was the keywords, but too the specificity of Joomla with validate=color which was to be taken into account for B/C reason (an old (not needed anymore as minicolors auto-validate input) validatation on color requiring a HEX value, to be disabled when usage of rgb(a) and when set in a form field, to not break validation and B/C behavior).

Ready for testing ? ;-)

instead of making the colorpicker only rgba when you add the opacity="" parameter why not make an rgbaformat and drop the opacity (i think it can be setted in the default attribute as others right?).

@andrepereiradasilva this is how i did it for joomla ;-)
The minicolors.js picker does not need to set a data-opacity, only if you want to set a default opacity (not really useful here, but all changes in library were done for B/C compatibility of the library itself. As Joomla was not using opacity before, i could go another way with 3 formats: hex, rgb and rgba, and so to simplify the xml attribute ;-) )

Add a Comment

Login with GitHub to post a comment