project-ufa / jpicker

jPicker is a fast, lightweight color picker jQuery plugin.
0 stars 0 forks source link

pass rgba value to bound text input #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. attach jPicker to a text input and enable alpha support
2. invoke the picker an set a semitransparent color 

What is the expected output? What do you see instead?
I would expect / like the value of the text input to be the 'rgba(nn,nn,nn,nn)' 
string, but it's just showing the hex value of the solid color. How is it 
supposed to work, how do I actually 'use' the rgba value (vant to save it as a 
settings value using a text input. I see then the picker div get the opacity 
property set, but thats not a real rgba value.

Original issue reported on code.google.com by mik...@jooze.net on 29 Jul 2011 at 7:40

GoogleCodeExporter commented 9 years ago
Yes, has this issue been resolved?

Original comment by chandru9...@gmail.com on 6 Aug 2011 at 1:31

GoogleCodeExporter commented 9 years ago
Hey I found out the change necessary to permanently make it argb just like its 
permanently rgb now :

Go to colorChanged event (It is in line number 525), change the line that deals 
with binded hex - MAKE all.hex into all.ahex :)

Following segments will help you locate it in case line number changes

THIS is the line :
---------------START
if (bindedHex && context != bindedHex.get(0) && context != hex.get(0)) 
bindedHex.val(all != null ? all.ahex : '');
---------------END

THIS is the context :
---------------START
colorChanged =
            function(ui, context)
            {
              var all = ui.val('all');
              if (context != red.get(0)) red.val(all != null ? all.r : '');
              if (context != green.get(0)) green.val(all != null ? all.g : '');
              if (context != blue.get(0)) blue.val(all != null ? all.b : '');
              if (alpha && context != alpha.get(0)) alpha.val(all != null ? Math.precision((all.a * 100) / 255, alphaPrecision) : '');
              if (context != hue.get(0)) hue.val(all != null ? all.h : '');
              if (context != saturation.get(0)) saturation.val(all != null ? all.s : '');
              if (context != value.get(0)) value.val(all != null ? all.v : '');
              if (context != hex.get(0) && (bindedHex && context != bindedHex.get(0) || !bindedHex)) hex.val(all != null ? all.hex : '');
              if (bindedHex && context != bindedHex.get(0) && context != hex.get(0)) bindedHex.val(all != null ? all.ahex : '');
              if (ahex && context != ahex.get(0)) ahex.val(all != null ? all.ahex.substring(6) : '');
            },
---------------END

Original comment by chandru9...@gmail.com on 6 Aug 2011 at 2:17