color_get_palette

Versions
5 – 6
color_get_palette($theme, $default = false)
7
color_get_palette($theme, $default = FALSE)

Helper function to retrieve the color palette for a particular theme.

▾ 3 functions call color_get_palette()

color_scheme_form in modules/color/color.module
Form callback. Returns the configuration form.
color_scheme_form_submit in modules/color/color.module
Submit handler for color change form.
_color_rewrite_stylesheet in modules/color/color.module
Rewrite the stylesheet to match the colors in the palette.

Code

modules/color/color.module, line 87

<?php
function color_get_palette($theme, $default = false) {
  // Fetch and expand default palette
  $fields = array('base', 'link', 'top', 'bottom', 'text');
  $info = color_get_info($theme);
  $keys = array_keys($info['schemes']);
  foreach (explode(',', array_shift($keys)) as $k => $scheme) {
    $palette[$fields[$k]] = $scheme;
  }

  // Load variable
  return $default ? $palette : variable_get('color_'. $theme .'_palette', $palette);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.