function color_get_palette

color_get_palette($theme, $default = FALSE)

Retrieves the color palette for a particular theme.

File

core/modules/color/color.module, line 173
Allows users to change the color scheme of themes.

Code

function color_get_palette($theme, $default = FALSE) {
  // Fetch and expand default palette.
  $info = color_get_info($theme);
  $palette = $info['schemes']['default']['colors'];

  if ($default) {
    return $palette;
  }

  // Load variable.
  // @todo Default color config should be moved to yaml in the theme.
  // Getting a mutable override-free object because this function is only used
  // in forms. Color configuration is used to write CSS to the file system
  // making configuration overrides pointless.
  return \Drupal::configFactory()->getEditable('color.theme.' . $theme)->get('palette') ? : $palette;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!color!color.module/function/color_get_palette/8.1.x