You are here

function color_get_info in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/color/color.module \color_get_info()
  2. 5 modules/color/color.module \color_get_info()
  3. 6 modules/color/color.module \color_get_info()
  4. 7 modules/color/color.module \color_get_info()

Retrieves the Color module information for a particular theme.

3 calls to color_get_info()
color_form_system_theme_settings_alter in core/modules/color/color.module
Implements hook_form_FORM_ID_alter().
color_get_palette in core/modules/color/color.module
Retrieves the color palette for a particular theme.
color_scheme_form in core/modules/color/color.module
Form constructor for the color configuration form for a particular theme.

File

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

Code

function color_get_info($theme) {
  static $theme_info = [];
  if (isset($theme_info[$theme])) {
    return $theme_info[$theme];
  }
  $path = \Drupal::service('extension.list.theme')
    ->getPath($theme);
  $file = \Drupal::root() . '/' . $path . '/color/color.inc';
  if ($path && file_exists($file)) {
    include $file;

    // Add in default values.
    $info += [
      // CSS files (excluding @import) to rewrite with new color scheme.
      'css' => [],
      // Files to copy.
      'copy' => [],
      // Gradient definitions.
      'gradients' => [],
      // Color areas to fill (x, y, width, height).
      'fill' => [],
      // Coordinates of all the theme slices (x, y, width, height) with their
      // filename as used in the stylesheet.
      'slices' => [],
      // Reference color used for blending.
      'blend_target' => '#ffffff',
    ];
    $theme_info[$theme] = $info;
    return $info;
  }
}