473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Color Aliases in CSS

It's be nice to be able to define color aliases in CSS.

For example, I could have something like this:

alias primary_color #0080ff
alias secondary_color #00ff00
alias highlight_color #ffff00

and so on

And in subsequent style classes/ids you'd have:

....
color: primary_color;
....

....
background-color: secondary_color;
....

....
border-color: highlight_color;
....

and so on.

Just some sort of easy way to maintain a sitewide color scheme.

Just pondering.

Is there an existing easy method of maintaining web site colors in one
spot?
Jun 20 '07 #1
9 12423
Quiet Desperation wrote:
It's be nice to be able to define color aliases in CSS.

Just some sort of easy way to maintain a sitewide color scheme.

Just pondering.

Is there an existing easy method of maintaining web site colors in one
spot?
Server side processing
Jun 20 '07 #2
Scripsit Quiet Desperation:
It's be nice to be able to define color aliases in CSS.
I think you mean that it _would be_ nice.
Is there an existing easy method of maintaining web site colors in one
spot?
In CSS, there is no way to define new symbols. Whether you can do such
things outside CSS depends on your authoring environment.

You can, however, organize CSS rules so that colors of different elements
are defined together. For example,

h1, h2, h3, h4, h5, h6, h7 { color: #060; background: #ffe; }

instead of separate rules for h1, h2, etc.

This is one reason for ordering a style sheet by properties rather than by
elements. That is, you would e.g. first have all the color and background
settings for all elements, then all the border settings, then all padding
settings, etc. This makes it more difficult to check quickly what you are
setting for each element, though.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 20 '07 #3
On Jun 20, 5:39 am, Quiet Desperation <x...@x.comwrote:
Is there an existing easy method of maintaining web site colors in one
spot?
http://dorward.me.uk/www/css/inheritance/

Jun 20 '07 #4
David Dorward escribió:
On Jun 20, 5:39 am, Quiet Desperation <x...@x.comwrote:
>>Is there an existing easy method of maintaining web site colors in one
spot?

http://dorward.me.uk/www/css/inheritance/
The 'Preprocessor' hint of the above reference can be implemented with
any general purpose macro-processor. By using 'm4' the original example
will look like:

-------color_aliases.m4 --------------
define(`primary_color', `#0080ff')
define(`secondary_color', `#00ff00')
define(`highlight_color', `#ffff00')
....
color: primary_color;
....
background-color: secondary_color;
....
border-color: highlight_color;
....
---------------------------------------

It can be processed as:

....m4 color_aliases.m4

....
color: #0080ff;
....
background-color: #00ff00;
....
border-color: #ffff00;
....
Regards.
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado

Jun 20 '07 #5
Manuel Collado wrote:
David Dorward escribió:
>On Jun 20, 5:39 am, Quiet Desperation <x...@x.comwrote:
>>Is there an existing easy method of maintaining web site colors in one
spot?

http://dorward.me.uk/www/css/inheritance/

The 'Preprocessor' hint of the above reference can be implemented with
any general purpose macro-processor. By using 'm4' the original example
will look like:
Hey! I thought I was the only one m4'ing
my CSS!

I was particularly pleased with these:

define(`notMacIE5',`/* Commented Backslash Hack hides rule from IE5-Mac \*/
$1
/* End IE5-Mac hack */')

define(`onlyWinIE6', `notMacIE5(`* html $1')')

define(`peekabooFix',`onlyWinIE6(`$1 { height: 1%; }')')

Which allow me to do things like:

notMacIE5(`#header a {float:none;}')

and

peekabooFix(.dialog .content)

BugBear
Jun 20 '07 #6
In article <46********@news.upm.es>,
define(`primary_color', `#0080ff')
define(`secondary_color', `#00ff00')
define(`highlight_color', `#ffff00')
Mmm. Nice, but this is a case where I have limited server side access.
I'm just a hobbyist. I've considered a small program that would take my
site files with custom tokens for colors, and copy them with the correct
hex codes inserted. Sort of a "designer side" script. :)

I've also been mucking about with various combiners but I wind up with
something that, to be honest, is litle better than a CSS-ized version of
the old FONT tags.
Jun 21 '07 #7
On Jun 21, 4:48 am, Quiet Desperation <x...@x.comwrote:
Mmm. Nice, but this is a case where I have limited server side access.
So do your preprocessing as part of your publication process, rather
then on-demand every time the file is requested.

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/
Jun 21 '07 #8
On Tue, 19 Jun 2007 21:39:51 -0700, Quiet Desperation <x@x.comwrote,
quoted or indirectly quoted someone who said :
>alias primary_color #0080ff
alias secondary_color #00ff00
alias highlight_color #ffff00
see http://mindprod.com/jgloss/htmlstaticmacros.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Jun 21 '07 #9
In article <11**********************@q75g2000hsh.googlegroups .com>,
David Dorward <do*****@gmail.comwrote:
On Jun 21, 4:48 am, Quiet Desperation <x...@x.comwrote:
Mmm. Nice, but this is a case where I have limited server side access.

So do your preprocessing as part of your publication process, rather
then on-demand every time the file is requested.
Exactly. I use Mac OS X so I can use a Perl script or something.
Jun 22 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Ash | last post by:
I recently had a project dropped into my lap that is written in JSP running on Apache/Resin. A previous version of the application is already running and configured on the production server, but...
0
by: Andrew | last post by:
With command-line interface ( 3.23.37, UNIX Socket ) all is well with column aliasing. However, column aliases disappear in Excel, over ODBC, when there are multiple (joined) tables in the query. ...
0
by: ECHO | last post by:
Hi @ all, Is It possible to create aliases on Tables which reside in another Databases WITHIN THE SAME Instance. The Problem is the following: The created application is possible to connect...
0
by: Krzysiek | last post by:
Hi all, I have an issue with QSYS\QADBXREF file - it keeps aliases on tables. I take care of an application that works on many places (servers) and on one of them it's not possible to create...
2
by: Andrey | last post by:
Hi, I have a DB2 8.2 client installed and I have created multiple database aliases using ODBC wizard. I am now trying to figure out how to remove these aliases. I tried removing data source,...
15
by: jacob navia | last post by:
Recently, we had a very heated thread about GC with the usual arguments (for, cons, etc) being exchanged. In one of those threads, we came into the realloc problem. What is the realloc...
22
by: Daniel Rucareanu | last post by:
I have the following script: function Test(){} Test.F = function(){} Test.F.FF = function(){} Test.F.FF.FFF = function(){} Test.F.FF.FFF.FFFF = function(){} //var alias = function(){}; var...
11
by: Chris Thomasson | last post by:
I was thinking of how I was going to create a robust versioning system in Standard C++ for my library and was wondering exactly what the point of a namespace alias is? The seem like a rather...
1
by: drexcol | last post by:
I am a php newbie and am trying to write a script that will direct visitors to specific pages on my website based on which of several url’s they have entered (all are aliases of the main website)....
6
by: dom.k.black | last post by:
Is it still common practice to use type aliases (INT, PCHAR etc). It looks ugly and breaks the syntax highlighting, are there any advantages these days (MSVC++6.0 and later)? I could understand...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.