Anyone successfully using the colour module with Omega?

Events happening in the community are now at Drupal community events on www.drupal.org.
rachel_norfolk's picture

Hi,

I'm trying to incorporate the color module in a Omega sub theme - specifically witht
the intention of then being able to change the colours of some text elements and the background using the Delta module.

I must admit I'm struggling, though, and I'm not finding much in the way of up to date documentation on the color module itself.

I have copied the color folder out of the Beta theme as a starter and also the process php files process-html.inc etc.

My main issue at the moment is an error on viewing a page causes the following error to be displayed when the process-html.inc is enabled. What could this be?

Notice: Undefined property: stdClass::$stylesheets in _color_html_alter() (line 83 of /Users/rachellawson/Sites/mysites/nappTV2/modules/color/color.module).
Warning: Invalid argument supplied for foreach() in _color_html_alter() (line 83 of /Users/rachellawson/Sites/mysites/nappTV2/modules/color/color.module).

Thanks!!

Rachel

Comments

Ah!

rachel_norfolk's picture

Ah!

I think I'm getting somewhere...

After sticking a dpm($themes, $name = NULL); into the _process_html I was able to compare the differences between my theme and the Beta theme.

It turns out that my Omega subtheme does not create a $stylesheets variable so the color module cannot decide what stylesheets to alter. After adding...

; ------- Declare default stylesheets
stylesheets[all][] = css/styles.css

...into my theme.info, things started working.

All I need to do now is decide if this is a sensible thing to do...

It's been a long day just to turn the background yellow!!

Rachel

so, can anyone explain to me

rachel_norfolk's picture

so, can anyone explain to me why the starterkit.info has lots of
css[styles.css][name] = Main Styles
style lines but not
stylesheets[all][] = css/styles.css?

Rachel

Those are for overriding and

bhosmer's picture

Those are for overriding and adding your own css.

stylesheets[] is limited in

fubhy's picture

stylesheets[] is limited in its features. It only allows you to add a stylesheet with a certain media query, nothing else (no options, no browser conditionals, etc.). Also the css[] tag allows Omega to serve you with a "Toggle Stylesheet" section on your theme settings UI where you can easily turn your CSS on and off without having to do any overrides on subthemes. E.g. If you wanted to create your own base theme (which, in return, is based on "Omega") and you want to provide some custom CSS along with that base theme you could leave the decission of wether to use that CSS to the one who uses your base theme by simply providing him with that checkbox to toggle that stylesheet off.

Ah - thanks for that. It

rachel_norfolk's picture

Ah - thanks for that. It makes sense and I agree that css[] does seem to be much better!

So far as I can tell, though, the color module makes a (naïve?) assumption that $stylesheets will exist and uses t to decide which css files to update.

Is it reasonable for me to go ahead and add in an extra stylesheets[] entry that color.module can pick up on but won't affect the running of Omega?

thanks - I'm learning so much this week!!

Rachel

Certainly. Add as many as you

bhosmer's picture

Certainly. Add as many as you want, but remember that Internet Explorer can only read 32 stylesheets.

Internet Explorer can only

fubhy's picture

Internet Explorer can only read 32 tags but it can read a nearly unlimited amount of @import'ed css files in one tag ;).

@Rachel I would even suggest to use stylesheets[] for that since that color css file is being used on EVERY single page of your website and therefore probably wont need any of the advanced features that css[] comes with.

in resume..

romaingar's picture

rachellawson :
So for debug your error with the color module (i've got the same problem...) you have added "stylesheets[all][] = css/styles.css" in your theme.info file? is it right ?
But is this file (styles.css) really exist ? And what is inside ? I dont understand your solution..;. :-/

... it works

romaingar's picture

Sorry i've tested your solution without emptied the cache...
(sorry for my bad english... ;-)

ive gotten it 90% to work....

mheinke's picture

i need help, im getting an error that i cant seem to get around.

undefined index link in _color_rewrite_stylesheet() in ... color.module

any idea how to get rid of that, or what it means. google wasnt helping me...since none of the D.O issues explain the error...

I think therefore I Drupal

Color module and omega 4

kork's picture

i got it working by leaving out the _color_html_alter($variables) in preprocess_html. Instead i borrowed some code from this funktion and implemented a hook_css_alter in my template.php file:

<?php
function MYTHEME_css_alter(&$css) {
  if (
module_exists ('color')) {
    global
$theme_key;
   
$themes = list_themes ();
   
$color_paths = variable_get ('color_' . $theme_key . '_stylesheets', array ());
    if (! empty (
$color_paths)) {
      foreach (
$themes [$theme_key]->stylesheets ['all'] as $base_filename => $old_path) {
        foreach (
$color_paths as $color_path) {
          if (
drupal_basename ($old_path) == drupal_basename ($color_path)) {
           
$css [$old_path] ['data'] = $color_path;
          }
        }
      }
    }
  }
}
?>

i hope this helps someone.

Omega Framework

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: