color

Random HTML color code for charts

When you do stack charts, it is important that the colors differ so much from each other that they are not mixed up. I made a function that returns a predetermined number of color codes that I've tested that is not too similar to each other.

When these color codes ends, a random number generator creates new color codes, these are not controlled, but my tests shows that it will do well.

Maybe I am doing a new feature one day that randomly generates an indefinite series of colors that can lie next to each other without being mixed up.

How to add colorpicker to a form textfield

This is how you can add colorpicker to a form textfield for instance in your theme settings file.


drupal_add_css('misc/farbtastic/farbtastic.css');
drupal_add_js('misc/farbtastic/farbtastic.js');

$form['color'] = array(
'#type' => 'textfield',
'#title' => t('Color pickmeup'),
'#default_value' => '#123456',
'#description' => '

',
);

$form['colorpicker_example'] = array(
'#type' => 'item',
'#description' => "