Forum:Defining a color to use on text

Hello everyone. I have a twofold question today about text color.

First of all I'd like to know how I can define colors Wiki-wide when called upon. You know how you can user class="color1" in a box to inherit the button color for its background? I want to know if there's a way to define more colors that can be called upon similarly.

My second question is, if the former is possible, how could I use this to change the color of certain text (obviously a hypothetical style="color:color3;" won't work).

The reason I'd like to know this is because I'd like to set the text of the top and secondary titles on infoboxes (such as this one) on the Wiki I work on to inherit the color from another location so I can easily change text color on all of them with one edit in the future.

If anyone can help, I'd much appreciate it.-Revitalizer (talk) 01:13, December 10, 2012 (UTC)


 * You could template the color:


 * lorem ipsum


 * Not the most elegant solution. But it would work. --


 * If the class of every table header you want to change the color of its content is "color1", as in the one you linked to, just add this line in your MediaWik:Common.css page

 .color1 { color: whateveryouwant; }
 * Or, you could make it through the template, by having it take a color as a parameter, but this will make use of inline styles (as in style="...") which is not really best practice, and should be avoided when possible, like in this case. -- Noemo n  * talk * 01:27, December 10, 2012 (UTC)


 * Just to be clear: A pure CSS solution is preferrable over a template solution. It's simpler. It's effects will be visible immediately. And it's less resource-intensive. --
 * Lordy, you two are fast. :) Thank you both so much!
 * I had actually tried doing it via template before (though differently/assuming wrongly :p ) by using  style="color:#;"  as the table header's style with Template:Infobox Link Color being ffffff, which worked in preview, but broke the template when published. Anyways, the MediaWiki fix worked fine. Thank you both again! -Revitalizer (talk) 01:58, December 10, 2012 (UTC)