For example I want to use RGB values in the colors array, basic reason is so I can tweak these in color.css with RGBa and create a more cooler colored themes :)

Problem - while this does work, you cannot create a custom color scheme - this looks, initially, like a failing of Farbtastic, if this is so then we need to get rid of Farbtastic and use something that will use RGB, because RGB is the way of the future (RGBa is just to useful to ignore and not support).

Additionally I have tried simply using the RGB equivalent in colors.css, this works for the default color scheme but again you can't customize it, or even any other scheme, the hex to rgb conversion breaks down somewhere.

If I'm doing something wrong then please advise, I'd really really love to use RGB in color module.

Here's a sample of my scheme:

  'schemes' => array(
    'default' => array(
      'title' => t('Winter'),
      'colors' => array(
        'base' => '255,255,255',
        'link' => '5,118,229',
        'top' => '244,244,244',
        'bottom' => '251,251,251',

Basically what happens is the RGB values show up in the color picker fields, but you cannot change them, them, and the color does not actually show, the field is white with the RGB value (text) only. Please see the screenshot of farbtastic and the color form failing badly.

CommentFileSizeAuthor
farbtastic-rgb.png27.94 KBJeff Burnz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeff Burnz’s picture

Title: How to use RBG in color module » How to use RGB in color module

Fixing typo in title, ops...

Jeff Burnz’s picture

Title: How to use RGB in color module » Support RGB/HSL in color module
Version: 7.0 » 8.x-dev
Category: support » feature
Issue tags: +farbtastic

In further testing color module can't work with HSL either - this is rather odd because afaict Farbtastic can support hsl and has functions for converting all three (hex, rgb, hsl). I am no js expert but from what I can tell its color.sj that is the problem, I am not sure.

I am changing this to a feature request against D8, I really think we should be able to use RGB or HSL as this will open up a world of sophisticated CSS3 designs we never thought possible with color module.

wjaspers’s picture

Does this issue specifically pertain to "Farbtastic"?

If not,
Why doesn't Drupal adopt something like JSColor? (http://jscolor.com/try.php)
It includes Hex/RGB/HSL, can function with AJAX as needed, and supports empty values.

Otherwise, there is a jQuery based picker, too:
http://www.eyecon.ro/colorpicker/

mfer’s picture

@wjaspers Farbtastic is the current color picker. Nothing here is farbtastic specific.

@Jeff Burnz What is is you want to happen here? The code just needs to be updated to work to the need. Is it you want to switch from hex to rgb? Something else?

dcrocks’s picture

Actually farbtastic does use hsl. There is some code in color.module converting hex colors to rgb to hsl and back. I think the issue is specifying rgb or hsl colors in css and passing those to the color.module, which currently only accepts hex colors. color.module has an interesting comment on line 278:
// Only accept hexadecimal CSS color strings to avoid XSS upon use.

tim.plunkett’s picture

Marked #1129698: Allow Transparent or Inherit in color palette as a duplicate, I think this is a better place to discuss expanding Color module.

markhalliwell’s picture

Status: Active » Postponed
Issue tags: -farbtastic +JavaScript, +Novice

I think we can still get this in though. Postponed on #481682: Decide what to do with Farbtastic library though.

inders’s picture

Seems like some work is being done @ https://drupal.org/node/1392528.

markhalliwell’s picture

Version: 8.x-dev » 9.x-dev

Hm, that seems to be dealing with just RGBA (with alpha), not HSL like this issue. Also moving to 9.x since this is a feature request.

mgifford’s picture

Issue summary: View changes
Status: Postponed » Closed (duplicate)
Related issues: +#1763040: Accumulative patch of fixes and enhancements
mitokens’s picture

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.