1 color.module _color_get_theme_from_file($filename, $theme_name)

Finds which theme a CSS file came from.


$filename: The file name that we are searching for.

$theme_name: The name of the theme that is being modified.

Return value

string: Returns the name of the theme that the CSS file came from.


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


function _color_get_theme_from_file($filename, $theme_name) {
  $themes = list_themes();
  $theme = $themes[$theme_name];

  $basename = backdrop_basename($filename);

  if (isset($theme->stylesheets)) {
    foreach ($theme->stylesheets as $group_name => $group) {
      foreach ($group as $file) {
        if ($basename === backdrop_basename($file)) {
          return $theme_name;

  if (isset($theme->base_theme)) {
    return _color_get_theme_from_file($filename, $theme->base_theme);