color_scheme_form($complete_form, &$form_state, $theme)Form callback. Returns the configuration form.
modules/color/color.module, line 144
<?php
function color_scheme_form($complete_form, &$form_state, $theme) {
$base = drupal_get_path('module', 'color');
$info = color_get_info($theme);
// See if we're using a predefined scheme.
$current = implode(',', variable_get('color_' . $theme . '_palette', array()));
// Note: we use the original theme when the default scheme is chosen.
$current = isset($info['schemes'][$current]) ? $current : ($current == '' ? reset($info['schemes']) : '');
// Add scheme selector.
$info['schemes'][''] = t('Custom');
$form['scheme'] = array(
'#type' => 'select',
'#title' => t('Color set'),
'#options' => $info['schemes'],
'#default_value' => $current,
'#attached' => array(
// Add Farbtastic color picker.
'library' => array(
array('system', 'farbtastic'),
),
// Add custom CSS.
'css' => array(
$base . '/color.css' => array('preprocess' => FALSE),
),
// Add custom JavaScript.
'js' => array(
$base . '/color.js',
array(
'data' => array(
'color' => array('reference' => color_get_palette($theme, TRUE)),
),
'type' => 'setting',
),
),
),
);
// Add palette fields.
$palette = color_get_palette($theme);
$names = array(
'base' => t('Base color'),
'link' => t('Link color'),
'top' => t('Header top'),
'bottom' => t('Header bottom'),
'text' => t('Text color'),
);
$form['palette']['#tree'] = TRUE;
foreach ($palette as $name => $value) {
$form['palette'][$name] = array(
'#type' => 'textfield',
'#title' => $names[$name],
'#default_value' => $value,
'#size' => 8,
);
}
$form['theme'] = array('#type' => 'value', '#value' => $theme);
$form['info'] = array('#type' => 'value', '#value' => $info);
return $form;
}
?>