473,657 Members | 2,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

define custom color names: is this possible

Hello,

I am making a website where the user can choose a 'skin'.
This works with asp en stylesheets.

In the stylesheet, a number of tags are (re)defined.
The main idea is to have a limited number of colors (lets say 4) and use
only these colors to color up every tag.

However, with a long list of (custom) styles, it is a lot of work to scan
every item in the stylesheet and assign the correct color definition.

So I am wondering,
is it possible to use variables or something like that to give a name to
custom color
and use this name for the rest of the style sheet?

In example:
ThemeColor1 = #012345
ThemeColor2 = #678901
ThemeColor3 = #234567
ThemeColor4 = #890123
and then
BODY
{
BACKGROUND: %ThemeColor1%
color:%ThemeCol or2%;
}
etc...

can this be done in stylesheets?
can this be done in ASP?

tia

bart plessers

--

=============== =============== ============
Hyper A.R.T.
bart plessers
Paul Van Ostaijenlaan 4
3001 Heverlee
BELGIUM
tel: +32 (16) 23.40.85
fax: +32 (16) 23.41.06
=============== =============== ============


Jul 20 '05 #1
4 19891
bart plessers wrote:
is it possible to use variables or something like that to give a name to
custom color and use this name for the rest of the style sheet? can this be done in stylesheets?
No
can this be done in ASP?


Yes (just output your CSS from ASP as you would with HTML. Make sure you set
the content type to text/css as ASP defaults to text/html)

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #2
bart plessers wrote:
[snip]
So I am wondering,
is it possible to use variables or something like that to give a name
to custom color
and use this name for the rest of the style sheet?

In example:
ThemeColor1 = #012345
ThemeColor2 = #678901
ThemeColor3 = #234567
ThemeColor4 = #890123

and then
BODY
{
BACKGROUND: %ThemeColor1%
color:%ThemeCol or2%;
}
etc...

can this be done in stylesheets?
can this be done in ASP?


I asked a similar question in another NG, and the answer was "no" in CSS:

Giving names to values in style sheets?
http://groups.google.c om/gr************* *************** ****@newsfep1-gui.server.ntli .net

But I use 2 techniques that you may find useful:

- I try where possible in the CSS to use rules that declare colours to
multiple selectors:
selector1, selector2, selector3 { background-color: #012345; }

So I only need to change the colour value once in the CSS if I don't like
#012345 for that theme.

- I use a class in the body tag to identify the theme (which applies to
background colour, text colour, link colours, border colours, etc). (It has
been pointed out that I could, and perhaps should, have used id). Then this
results in blocks of rules in the CSS such as:

http://www.barry.pearson.name/assets...photograph.css

/* Styles for photo pages with eggshell background. */

body.eggshell { background-color: #DFD4BC; background-image:
url(eggshell.gi f); color: #272727; }

body.eggshell a:link, body.eggshell a:visited { color: #0000FF;
text-decoration: none; }
body.eggshell a:hover { color: #FF0000; text-decoration: none;
background-color: #FFFFFF; }

body.eggshell div.middle, body.eggshell div.inner { padding: 7px; border:
solid #554433 1px; }
body.eggshell div.middle { border-left-color: #FFF7EE; border-top-color:
#FFF7EE; }
body.eggshell div.inner { border-right-color: #FFF7EE; border-bottom-color:
#FFF7EE; }

/* Styles for photo pages with dark green background. */

body.darkgreen { background-color: #0B360B; background-image:
url(dark_green. gif); color: #C1C1C1; }

body.darkgreen a:link, body.darkgreen a:visited { color: #4444FF;
text-decoration: none; }
body.darkgreen a:hover { color: #FF0000; text-decoration: none;
background-color: #FFFFFF; }

body.darkgreen div.middle, body.darkgreen div.inner { padding: 7px; border:
solid #000000 1px; }
body.darkgreen div.middle { border-left-color: #007700; border-top-color:
#007700; }
body.darkgreen div.inner { border-right-color: #007700; border-bottom-color:
#007700; }

(I'm not sure how well those actually address your problem).

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #3
On Sat, 11 Oct 2003 10:57:09 +0000, "bart plessers"
<ba**********@h otmail.com> wrote:
So I am wondering, is it possible to use variables or something like
that to give a name to custom color and use this name for the rest of
the style sheet?


This is a job for DHTML of some kind. CSS isn't equipped for variable
substitution... I remember wishing I could do something of the sort
myself.

I know absolutely zero about ASP, but my guess is that's where you'd want
to start. I'd use server-side includes, I think (much like the way I'd
switch stylesheets for a whole site on the fly). Either way it needs to
be outside the html/css axis.

Hope that helps.

--Alison
Jul 20 '05 #4
I'm not sure if you are wanting to have several different stylesheets,
but the user could pick the color scheme, assigning your variable and
call it like this:

<link rel=stylesheet href=<%=strcolo r%>.css type=text/css>
<link rel=stylesheet href=<%=strfont %>.css type=text/css>

I did that one time and it worked okay. Maybe this is oversimplistic
and I've misunderstood the question? In any case you can make links to
several stylesheets as needed.
Jul 20 '05 #5

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

Similar topics

2
3913
by: Joe Gazda | last post by:
I'm a relative newbie to PHP, but have been able to put together some PHP code to generate a CSV/XLS file from a Query result. Now, I would like to include custom column names instead of the MySQL column table names. I know that there are codes to generate tabs and carriage returns, but can't find anything about including "commas" in a string to output to the file to separate the custom field names. I'd appreciate some help with a line of...
97
27767
by: s | last post by:
Can I do this: #define MYSTRING "ABC" .. .. .. char mychar = MYSTRING; .. .. ..
20
2820
by: Dead RAM | last post by:
Hey people, i'll try to keep this short ;) Here is what I want to type (or at least close too)... #define VER_BUILD 1 #define STR_VER_BUILD "VER_BUILD" But what happends is the preprocessor see the quots in STR_VER_BUILD and replaces that text with "VER_BUILD"... I need it to see the VER_BUILD and replace it with 1, and only after doing
10
2830
by: Brett | last post by:
If I have many hard coded values such as file paths, file names, timeouts, etc, where is the best place to define them? Meaning, in the case something needs changing for example, rather than running down all the subs or functions that may contain these values, I'd like one place to change them and have that changed reflected in the subs or functions that use those values. I'd like to avoid globals; keeping the values private to only those...
2
1866
by: J R M | last post by:
I've developed a custom control (it's basically a drop-down list and then a couple of textboxes to include meta-data for the selection) that I'm embedding into another custom control (the idea is to allow a dynamic number of control1 to appear in control2). Everything renders correctly, however I could never retrieve data on postback from my embedded controls. Upon closer inspection, all of the embedded controls output without any "name"...
12
13340
by: Just D | last post by:
All, It was possible before in Pascal, C++, etc. to define our custom data type or redefine the existing type, like in Turbo Pascal we could assume that shortint is int and use all references to shortint like all these variables became int. How can we define our own user data type in C# is we can? Just D.
2
5106
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application = Windows Forms class B = a singleton hosted within A. B is responsible for dynamically loading classes X, Y, and Z.
2
19457
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.