If you have the default layout and want to allows users (auth_users)
to personalize their colors here is how:
in model before aith.define_tables() insert
COLOR_SCHEMES={
'black':('black','white','#999',URL('static','images/
background.png')),
'red':('white','#333','#f00',URL('static','images/
background.png')),
'green':('white','#333','#090',URL('static','images/
background.png')),
'blue':('white','#333','#339',URL('static','images/
background.png')),
'pink':('ff66cc','#333','#cc66cc',URL('static','images/
background.png')),
'orange':('ffcc99','#333','#ff6600',URL('static','images/
background.png'))
}
db.define_table('auth_user',
Field('first_name', length=512,default=''),
Field('last_name', length=512,default=''),
Field('nickname',length=32,default=''),
Field('email', length=512,default=''),
Field('password', 'password', readable=False, label='Password'),
Field('city',default=''),
Field('country',default=''),
Field('color_scheme',requires=IS_IN_SET(('black','red','green','blue','pink','orange'))),
Field('registration_key',
length=512,writable=False,readable=False),
Field('reset_password_key', length=512,
default='',writable=False,readable=False),
Field('registration_id', length=512,
default='',writable=False,readable=False),
format = lambda row:
A(row.nickname,_href=URL(r=request,f='user_info',args=row.id)) if
auth.user else row.nickname
)
and in the layout before you close </head> insert
{{if auth.user and auth.user.color_scheme:}}
{{c1,c2,c3,bg=COLOR_SCHEMES[auth.user.color_scheme]}}
<style>
#layout { background: url('{{=bg}}' repeat-x {{=c1}}; color:
{{=c2}}; }
#statusbar {border-bottom: 5px solid {{=c3}}; }
#header {background: transparent; color: {{=c2}}; }
#footer {border-top: 5px solid {{=c3}}; background: transparent;
color: {{=c2}};}
a { color: {{=c3}}; }
h1, h2, h3 { color: {{=c3}}; }
</style>
{{pass}}
Done!
Now when your users edit their profile they can choose a color scheme
and when logged in they will see your pages in their color scheme. You
can of course be more creative with the schemes.
It would be nice to have a repository of color schemes that apply to
the default layout and an app to post and share them.
Massimo