Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

named-color: is it possible?

0 views
Skip to first unread message

nikkei

unread,
Apr 7, 2002, 7:59:51 PM4/7/02
to
Hi all, I'm wondering if there's a way to give a specific name to a color.
An example, instead of this:

.BACKGROUND_1{
background-color: #FF0000;
}

.FONT_1{
color: #FF0000;
}

I want to do something like this:

define-color: MyColor=#FF0000
.BACKGROUND_1{
background-color: MyColor;
}

.FONT_1{
color: MyColor;
}

Is it possible? Thanks in advance!


viza

unread,
Apr 8, 2002, 5:04:23 AM4/8/02
to
and then nikkei said:

> Hi all, I'm wondering if there's a way to give a specific name to a color.
> An example, instead of this:
>

> define-color: MyColor=#FF0000
> .BACKGROUND_1{
> background-color: MyColor;

No. Not in CSS1 or 2. The only names that are valid for <color> are
transparent, one of the colour 16 names (aqua, black, blue, fuchsia, gray,
green, lime, maroon, navy, olive, purple, red, silver, teal, white, and
yellow), a specific color number, or one of the system colours.

Hans Gommers

unread,
Apr 8, 2002, 7:40:29 AM4/8/02
to
If you really want to do that you could make a script for it. The script
would go through the stylesheet(s) and replace MyColor with the defined
color.

Hans

"viza" <m...@work.not> schreef in bericht
news:D1ds8.5328$M71.1...@news6-win.server.ntlworld.com...

nikkei

unread,
Apr 8, 2002, 9:13:36 AM4/8/02
to
thanks all, I'm only trying to unify the management of color values.btw,it
seems impossible by now.
bye.
Hans Gommers <hans.g...@ksdnet.nl> wrote in message
u8zzoIv3BHA.1732@tkmsftngp02...

issunbooshi

unread,
Apr 9, 2002, 5:19:23 AM4/9/02
to
As said only with script.
Since IE55 there is support for socalled JScript expressions which goes a bit  as follows: this paragraph has the class "font_1" which is defined as color:expression(MyColor2). The DIV below has the class background_1 which isdefined as background-color:expression(MyColor) The input allows changing this text color dynamically The MyColor is set in script to red (FF0000).
 
<SCRIPT>
var MyColor = "#FF0000";
var MyColor2 = "#0000FF"
function colorChange()
{
MyColor2 = inputcolor.value;
}
</SCRIPT>
 
<STYLE>
.background_1{background-color:expression(MyColor);}
.font_1 {color:expression(MyColor2);}
}
</STYLE>

 
Font color 
BACKGROUNDCOLOR DIV
.BACKGROUND_1{
background-color: expression(MyColor)
}

.FONT_1{
color:expression(MyColor2);
}
"Hans Gommers" <hans.g...@ksdnet.nl> wrote in message news:u8zzoIv3BHA.1732@tkmsftngp02...

PeterMcC

unread,
Apr 9, 2002, 7:50:09 AM4/9/02
to
"issunbooshi" <ur...@orbi.it> wrote in message
news:eAhz9f63BHA.2260@tkmsftngp02...


Font color

.FONT_1{
color:expression(MyColor2);
}

Hans

Small point, no big deal, but it's helpful to many if you post in plain
text - perhaps a link to the page with a demo on it instead?

--
Cheers

PeterMcC


nikkei

unread,
Apr 9, 2002, 1:02:14 PM4/9/02
to
Thanks! I'll try and report.

>issunbooshi <ur...@orbi.it> wrote in message eAhz9f63BHA.2260@tkmsftngp02...

gilly3

unread,
Apr 25, 2002, 3:47:09 PM4/25/02
to
"nikkei" <nik...@supertokio.it> wrote in
news:K45s8.138915$1S3.4...@twister1.libero.it:

> Hi all, I'm wondering if there's a way to give a specific name to a
> color.

In IE, you can use any of these named colors:
http://msdn.microsoft.com/workshop/author/dhtml/reference/colors/colors.asp

good luck!

-ivan.

0 new messages