Colorpicker module updated (new interface, less code)

skilip - November 19, 2008 - 08:28
Project:Colorpicker
Version:5.x-1.x-dev
Component:User interface
Category:feature request
Priority:minor
Assigned:skilip
Status:needs review
Description

I've spent some time in updating the colorpicker. Last sunday I've tried to contact dwees (the developer of colorpicker module) but I haven't heard from him yet. To sum up a few thing I've done:

  • I've removed the form element 'textfield'. Since the module requires Javascript to function, I thought it would be better to let js add the color-picker to the textfields. It's also less confusing having just one form element for the color-picker.
  • The form element 'colorpicker_textfield' is remained. I've removed the option to set the maxwidth ad size attributes dynamically, since these should always be 7.
  • The script is almost completely rewritten. Again, the script now attaches the color-picker. The script also has some extra validation. The user can only input valid hexadecimal characters.
  • The styles have been rewritten.
  • The demo page has been changed to display examples with the new implementation of the color-picker.

A few things I haven't done yet:

  • I've not touched the CCK module (I'm not very familiar with CCK).
  • The module I've sent you is D5. A version for D6 is just a little extra work. Maybe I'll do that next week.
  • An earlier version of my implementation of a colorpicker module made it possible to drag the color-picker. I guess most Drupal users would not need such extra eye-candy, and will complain about loading an extra jQuery plugin for it. Therefore I omitted this feature.

Here's a little example of the new colorpicker UI:

#1

skilip - November 19, 2008 - 08:30
AttachmentSize
colorpicker.png 40.67 KB

#2

dwees - November 19, 2008 - 10:03

Yeah I'm sorry I haven't responded to your email yet. I've got two gigantic projects due this week for my Masters degree. I think the work you are doing here looks really good. This is a good direction to take this module.

Interesting note, some of code has been borrowed for the calendar project so we may end up becoming a dependency for a pretty major project if we can get this stuff all sorted out. I think with these improvements you have made, with some user testing, it might be time for an official release.

The CCK stuff is relatively straight forward actually, you almost don't need to do very much to get the existing code to work with the updated CCK module Karen patched. All CCK wants to know is, how are you going to store your data, and what is the form element going to look like. Since we have removed our extra options, then we don't need to worry about those in the CCK definition either.

I'll have more free time in December to look at this stuff when my semester finishes. I'll do some testing then.

#3

skilip - December 9, 2008 - 10:09

Here's de patch for the stuff discussed above.

AttachmentSize
colorpicker.patch 9.67 KB

#4

univate - February 14, 2009 - 07:39

Have you seen this jquery color picker? it more closely matches the color pickers found in other applications:
http://eyecon.ro/colorpicker/

Just another idea for UI improvements.

#5

dwees - February 14, 2009 - 09:25

Although shipping a different Colorpicker UI with this module is attractive, it requires the adoption of a different set of code, none of which we can add to our project because of the 'no 3rd party code in cvs' policy. We'd have to force users to download this different Colorpicker UI and then handle support requests when/if their API changed.

Dave

#6

univate - February 15, 2009 - 02:32

Yes that 3rd party code rule...

There are other examples where modules are built around a jquery plugin/effects and include all the javascript code in cvs:
e.g.
http://drupal.org/project/jcarousel (includes code from http://sorgalla.com/jcarousel/)

Even the farbtastic color picker is hosted as a separate project (I'm not sure its history and whether it was written for drupal first though):
http://acko.net/dev/farbtastic

Although even if not a direct use of that code/UI, some of the ideas could be replicated within this module.

I also thought it appropriate to bring your attention to this alternative jquery plugin in this issue on improvements to the interface. If I have some spare time I might even create a patch to try it out myself.

#7

skilip - February 16, 2009 - 07:07

I totaly agree with dwees. This module should use only Drupals built in colorpocker. If the module also is going to support other colorpicker libraries, there will be tons of feature request as well as issues in its issuequeue. If Drupal is putting another colorpicker in core, this module should follow.

Btw. I really fancy the UI colorpocker more than the farbtastic. ;)

#8

skilip - February 18, 2009 - 13:20

dwees, are we set for the patch I've committed here?

#9

dwees - February 19, 2009 - 06:56

Yeah, I thought you committed it already.

Dave

#10

skilip - February 19, 2009 - 07:22

Nope, I was waiting for a green light (and some spare time). Shall I name it version 2?

#11

dwees - February 19, 2009 - 12:15

Yeah that's a good idea. It's different enough it needs it's own branch.

Dave

#12

slurslee - July 23, 2009 - 04:36

This seems closed too. Overall I like the simplified code. I don't know why my CCK implementation seemed so bloated. I mentioned in my d5 patch that I'd added formatters, but I haven't tried implementing them for the d6 version. If that's not already on your list, I don't mind messing with it at some point. The eyecon color picker mentioned above could be added by a separate module that extends colorpicker. It might be interesting to try it one of these days.

 
 

Drupal is a registered trademark of Dries Buytaert.