Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smerrill/1080578 to your computer and use it in GitHub Desktop.
Save smerrill/1080578 to your computer and use it in GitHub Desktop.
D7 Color Picker
$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,
'#attached' => array(
// Add Farbtastic color picker.
'library' => array(
array('system', 'farbtastic'),
),
'#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