Theme Constants?

T

Teresa Church

Is there such a thing as defining a constant (or a variable) for a
theme? For example, storing a color code and then using it in 4 or 5
places, so to change the color I only have to edit one line?

TIA
 
C

Cowboy \(Gregory A. Beamer\)

It is called CSS. Even if you are using Microsoft's theming engine, you can
set up a style and apply it in multiple places. Color is just one of the
options through CSS.
 
T

Teresa Church

Sure, but in CSS you can't set constants either, at least not without
a lot of tinkering. So if I want the same color in CSS in 4 different
places, I have to change it in 4 different places. Same problem.
 
T

Teresa Church

Basically what I currently have is a set of 4 themes, all of which are
tied to their own CSS.

I want a consistent look-and-feel across each theme; so setting the
forecolor for a specific skin then can be applied across all controls
skinned with that skin (so I don't have to change it for Label,
CheckBox, etc. individually).

I don't want to put this in app settings because then I have 4
different app settings and it gets unmanageable; it also is then
difficult to add new themes.

I get the feeling that the short answer to my question is a simple
"no" ...

Thanks.
 
B

bruce barker

please read about css inheritance (the cascading part of css)


-- bruce (sqlwork.com)
 
T

Teresa Church

Thanks, I did, but I really don't see how that would help me here.

If I want to set a.navigation's color to be the same as table's
default border color, I have to set the color twice instead of one
time to a constant and then assign the constant to the settings.
 
J

Jon Paal [MSMD]

Sounds like you are referring to a css class

define the class and it is applied to the control whenever.

Change the class color and it is reflected everywhere it is used.
 
T

T. Church

Either I'm being obtuse or I'm not explaining myself correctly ...
hopefully it's the former.

Can you give an example of what my CSS will look like so for each
color on my palette, I only set it once and can change it easily?
 
J

Jon Paal [MSMD]

there's unlimited resources for css tutorials and examples via google.

a simple css class looks like :

..sidebar {
font-size:11px;
margin-top:2px
 
T

T. Church

Yes, I am fairly familiar with CSS, and am aware that there is no way
to have variables or constants in a CSS.

For example, I know this will not work:

#define HIGHLIGHT = #FFFFFF

a.navigation:hover {
color: HIGHLIGHT;
}

td.sidebar {
border-color: HIGHLIGHT;
}

Note that these are two different elements and two different classes.
BUT if I wanted to change the highlight, I could change it in *1 place
only*.

There are various resources available on Google that say this exact
scenario IS NOT POSSIBLE.

My question remains ... *** Is there any way to do this via ASP.NET
themes? ***
 
G

George Ter-Saakov

Everything is possible. Depends how much money you have.

Your CSS file can be dynamicly created with .NET code.
Simply have in your HTML files instead of
<link rel="stylesheet" type="text/css" href="my.css">
have it like
<link rel="stylesheet" type="text/css" href="my.aspx">


And your my.aspx can load my.css file and perfom the substitution.
so my.css has
a.navigation:hover {
color: @HIGHLIGHT@;
}

td.sidebar {
border-color: @HIGHLIGHT@;
}


and my.aspx will have folowing code
using (StreamReader sr = new StreamReader("my.css"))
{
strinf s = sr.ReadToEnd();
s.Replace("@HIGHLIGHT@", "#FFFFFF");
}



George

T. Church said:
Yes, I am fairly familiar with CSS, and am aware that there is no way
to have variables or constants in a CSS.

For example, I know this will not work:

#define HIGHLIGHT = #FFFFFF

a.navigation:hover {
color: HIGHLIGHT;
}

td.sidebar {
border-color: HIGHLIGHT;
}

Note that these are two different elements and two different classes.
BUT if I wanted to change the highlight, I could change it in *1 place
only*.

There are various resources available on Google that say this exact
scenario IS NOT POSSIBLE.

My question remains ... *** Is there any way to do this via ASP.NET
themes? ***

there's unlimited resources for css tutorials and examples via google.

a simple css class looks like :

.sidebar {
font-size:11px;
margin-top:2px

}applied it looks like:<div class="sidebar" >sidebar stuff here</div>
T. Church said:
Either I'm being obtuse or I'm not explaining myself correctly ...
hopefully it's the former.
Can you give an example of what my CSS will look like so for each
color on my palette, I only set it once and can change it easily?
On Jun 19, 1:26 pm, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @ everywhere
dot com> wrote:
Sounds like you are referring to a css class
define the class and it is applied to the control whenever.
Change the class color and it is reflected everywhere it is used.
Is there such a thing as defining a constant (or a variable)
for a
theme? For example, storing a color code and then using it in 4
or 5
places, so to change the color I only have to edit one line?
TIA
 
J

Jon Paal [MSMD]

perhaps save it as an asp file to have dynamic content.


<% HIGHLIGHT = "#FFFFFF" %>

a.navigation:hover {
color: <%= HIGHLIGHT %>;
}

Not sure how this would translate to ASP.net themes.



T. Church said:
Yes, I am fairly familiar with CSS, and am aware that there is no way
to have variables or constants in a CSS.

For example, I know this will not work:

#define HIGHLIGHT = #FFFFFF

a.navigation:hover {
color: HIGHLIGHT;
}

td.sidebar {
border-color: HIGHLIGHT;
}

Note that these are two different elements and two different classes.
BUT if I wanted to change the highlight, I could change it in *1 place
only*.

There are various resources available on Google that say this exact
scenario IS NOT POSSIBLE.

My question remains ... *** Is there any way to do this via ASP.NET
themes? ***

there's unlimited resources for css tutorials and examples via google.

a simple css class looks like :

.sidebar {
font-size:11px;
margin-top:2px

}applied it looks like: said:
Either I'm being obtuse or I'm not explaining myself correctly ...
hopefully it's the former.
Can you give an example of what my CSS will look like so for each
color on my palette, I only set it once and can change it easily?
On Jun 19, 1:26 pm, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @ everywhere
dot com> wrote:
Sounds like you are referring to a css class
define the class and it is applied to the control whenever.
Change the class color and it is reflected everywhere it is used.
Is there such a thing as defining a constant (or a variable) for a
theme? For example, storing a color code and then using it in 4 or 5
places, so to change the color I only have to edit one line?
TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top