[ALLY] Other question about stylesheets
[1/3] from: etienne::alaurent::free::fr at: 25-Apr-2001 1:21
Hi,
I want to implement customer skins in my app with stylesheets. And I found two
solutions :
1-define all stylesheets with 'styles (And make a function to define and save
customer skin styles. The new skin will be loaded and reflected whenever the
app comes up.) and use these stylesheets in a layout definition.
example:
------
st-backdrop stylize [
backdrop: backdrop with [
color: none
image: none
effect: [gradient -1x-1 50.80.120 70.130.180]
]
]
example: layout [
styles st-backdrop
backdrop
text "This is an example !"
]
view example
2-define objects with all attributes of any style used. When a layout comes up,
the defined vars are used.
Example:
------
tpl-backdrop: make object! [
color: none
effect: [gradient -1x-1 70.130.180 50.80.120]
image: none
]
example: layout [
backdrop with [
image: tpl-backdrop/image
color: tpl-backdrop/color
effect: tpl-backdrop/effect
]
text "This is an example !"
]
view example
What is the best policy to implement this ? and why ?
Thanks.
Etienne
[2/3] from: allenk:powerup:au at: 25-Apr-2001 11:24
Hi Etienne,
I would vote for option1 over option2. Using stylize you have the power to
not only add new styles but can overide all the existing ones, so you can
enforce a uniform (but different) style on all your apps. So changing a look
and feel for an app is just a matter of changing the name of the style used
in layout or altering the stylesheet.
; a style
corporate-styles: stylize [
text: text font-size 12
h1: h1 crimson
logo: image [image %xyz.gif]
....
....etc
]
;Later the company decides to change logo and major headings are to be in
the new company color of "navy"
.
corporate-styles: stylize [
text: text font-size 12
h1: h1 navy
logo: image [image %xyz2.gif]
...
...etc
]
However you may also decide to combine the two methods you present by doing
the following.
corp-colors: [
alt-headings: crimson
background: black
company-green: leaf - 0.30.0
]
corporate-styles: stylize [
text: text font-size 12
h1: h1 corp-colors/alt-headings
logo: image [image %xyz2.gif]
...
...etc
]
This gives you the power of simple styles in layouts without the need to add
facets each time they are used, but also gives you a standard place to find
those facets when needed.
layout [h1 "New heading" corp-colors/company-green]
I hope this made some sense. The answer you need depends on your situation
really.
Cheers,
Allen K
[3/3] from: etienne:alaurent:free at: 27-Apr-2001 1:08
Hi, Allen
Thank you for your opinion. that's good for me.
Cheers,
Etienne
Le mer, 25 avr 2001, vous avez écrit :