Click here to register or to donate.Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Setting a reusable colour palette with php?

#1

Mar 2, 2010, 02:20 AM

camjackson

2 posts · Mar 2010

I've spent a bit of time creating a colour palette for myself to use across my site. The problem is that if I want to tweak one of the colours a little bit, I have to go through all the atahualpa options finding all the instances of that colour and changing it.
What I want to do is define some colours in one place, so I can just refer to them by name (like the presets red, blue etc) in multiple places.
I've done all the googling I can, and discovered that CSS doesn't have variables, but that it's possible to do with php. The php code that I found and modified looks like this:

Assuming that's correct (which it might not be for all I know), how do I now refer to those colour names when setting colours in CSS? Also, where should that code go so that it will apply to my whole site? At the moment I've got it in the body style section, seeing as it says that that style will apply to everything that doesn't get its own style.

Alternatively, is there a completely different way of achieving this that I've missed?