color_get_palette

color_get_palette($theme, $default = FALSE)

Retrieves the color palette for a particular theme.

File

core/modules/color/color.module, line 174
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;
}
doc_Drupal
2016-10-29 08:50:08
Comments
Leave a Comment

Please login to continue.