Friday, September 14, 2007

Easily changing theme colours in Drupal

I like the "Garland" theme for Drupal. Its nice an elegant. However I needed to change the hues to represent a certain corporate colour. What I accidentally found while browsing through the CSS files was there there was some "preset" colours.
Intrigued, I did a google search and was pleasantly surprised to find that the Garland theme in Drupal allows easy changing of colours just by clicking on colour wheels! "How to change colours on the Garland theme". Theres even a nice screencast by the author.
However, when I went to "Administer >> Themes >> Garland-configure", I couldn't see the colour pickers as the screenshot above.

So I checked "Administer >> Modules" to double check that the Colors module was installed. And it was.

Checked "Administer >> Logs >> Status Report" and saw that the GD Graphics Library was also installed. All OK.

Then finally, "Administer >> Site Configuration >> File System" must have its "Download method" as "Public - files are available using HTTP directly."

Once that was selected (which it wasn't), the Colour pickers appeared!

[Drupal could improve by telling its admins what to enable to get the pickers to appear]

I changed the colours, and the onscreen colours changed immediately. However, when I clicked on "Save", my new colours refused to save, and it complained that PHP required 2.4MB more memory!

Strange, I checked the computer's memory, swap and harddisk and found no shortage. This link however says that its a PHP setting. /etc/php.ini, under the ; Resource Limits section. I changed it from 8MB to 18MB.

memory_limit = 18M ; Max amount of memory a script may consume

Once that was changed, the new colour scheme worked like a charm. This page "Integrating the Color Module" describes in detail how Drupal uses a PNG template, the GD library to create the nice gradients, and the PHP calls to slice up the images to create the templates for use. Quite fascinating.

yk.

1 lewser:

james said...

nice article...man
keep it up..

http://drupalranch.com/