Skip to content

Instantly share code, notes, and snippets.

@johnrobertwilson
Created July 13, 2011 15:46
Show Gist options
  • Save johnrobertwilson/1080572 to your computer and use it in GitHub Desktop.
Save johnrobertwilson/1080572 to your computer and use it in GitHub Desktop.
D7 Color Picker
drupal_add_css('misc/farbtastic/farbtastic.css', 'file');
drupal_add_js('misc/farbtastic/farbtastic.js', 'file');
$form['chart_options']['plot']['plot_background_color'] = array(
'#type' => 'textfield',
'#title' => t('Page Title Color'),
'#default_value' => '#FFF',
'#description' => '<div id="plot_background_colorpicker"></div>',
'#size' => 9,
'#maxlength' => 7,
'#suffix' => "<script type='text/javascript'>
jQuery(document).ready(function() {
jQuery('#plot_background_colorpicker').farbtastic('#edit-plot-background-color');
});
</script>",
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment