Created
July 13, 2011 15:07
-
-
Save johnrobertwilson/1080486 to your computer and use it in GitHub Desktop.
Farbtastic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$theme = 'energy'; | |
$info = color_get_info($theme); | |
$info['schemes'][''] = array('title' => t('Custom'), 'colors' => array()); | |
$color_sets = array(); | |
$schemes = array(); | |
foreach ($info['schemes'] as $key => $scheme) { | |
$color_sets[$key] = $scheme['title']; | |
$schemes[$key] = $scheme['colors']; | |
$schemes[$key] += $info['schemes']['default']['colors']; | |
} | |
$form['chart_options']['plot']['background_color'] = array( | |
'#type' => 'select', | |
'#title' => t('Color set'), | |
'#options' => '', | |
'#default_value' => '', | |
'#attached' => array( | |
// Add Farbtastic color picker. | |
'library' => array( | |
array('system', 'farbtastic'), | |
), | |
// Add custom CSS. | |
'css' => array( | |
drupal_get_path('module', 'color') . '/color.css' => array(), | |
), | |
// Add custom JavaScript. | |
'js' => array( | |
drupal_get_path('module', 'color') . '/color.js', | |
array( | |
'data' => array( | |
'color' => array( | |
'reference' => color_get_palette($theme, TRUE), | |
'schemes' => $schemes, | |
), | |
'gradients' => $info['gradients'], | |
), | |
'type' => 'setting', | |
), | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment