As far as I can tell there are at least 3 different colour modules that provide either a form element or a field type or both. Some also provide different JS widgets.

It would be really great if they could be merged and regrouped. What I suggest (but sadly lack the time for :( is a model where a core element provides the basic form element and field type, and integration with Drupal core's Farbtastic, and other modules provide just the extra JS widgets. This is similar to the same way Date works, with the core module providing a basic widget, and the Date Popup module adding a fancier widget.

In summary:

- colorfield is the base module:
-- farbtastic colorpicker form element
-- field type
-- widgets:
--- textfields
--- farbtastic colour picker

- other modules provide further JS form elements and field widgets.

Comments

Artusamak’s picture

Title: unified colour widget & field type » Unified colour widget & field type
Category: task » feature
Status: Active » Needs review

Interesting feedback, i wasn't sure to clearly understand your comment the first time i read it and then did what i wanted to do with the code base and my conclusion went to implement this, only offering two widgets, one with the split fields to input the red, green and blue value separately and another widget to input the hexadecimal value.
The last widget is configurable, you can enable the feature of the colorpicker which is farbtastic (core colorpicker) by default and if you want you can use another one. If jQuery update in 1.7 version is enabled you can benefit from minicolors.
Then a javascript file is embedded with the #attached attribute this way if someone wants to use another library he just has to implement a form_alter() to alter the loaded library.

I think that at the end it match the purpose of the issue you created, let's discuss about that!

Thanks for the feature suggestion.

joachim’s picture

What I meant is that ideally the Drupal contrib ecosystem should only have one project that provides a colour field type. Projects that provide different JS colour picker widgets should just provide the widget type, (and therefore depend on the field type). It would then make sense for the colour field type module to just include basic widgets, using core JS.

Then you would install one of these combinations:

- colour field type module, and use one of its basic widgets
- colour field type module + a colour field widget module to get a fancier widget.

Changing the widget later would be a case of just enabling/disabling a widget module and changing the widget on the field.

It sounds like we're getting towards that :)

Artusamak’s picture

Status: Needs review » Fixed

I always have mixed feelings about those modules only there to add a small chunk of a feature, in our use case a colorpicker (it slows the system when there is a lot of them) but yes that's the idea of the extensibility of Drupal and here it doesn't make sense to have multiple color picker as you would enable multiple video providers for instance.
Since the use case is covered i'm gonna mark the issue as fixed, feel free to reopen it if you want to add something, i also invite you to test the new version module of the module to see if you discover any bug! :)

joachim’s picture

> here it doesn't make sense to have multiple color picker as you would enable multiple video providers for instance.

No, but different sites may want different colourpickers. Clearly not everyone agrees on which is the best colourpicker widget, since there are different ones out there!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.