Can anyone have idea for How to provide option for users to set theme color for there pages.
Can anyone have idea for How to provide option for users to set theme color for there pages.
Can you please explain it , Not clear what do you mean by theme color?
like
2)providing color list to user and assigned it to specific user using Cookies/Sessions or storing colors for user in table and assigning when user login
providing color list to user and assigned it to specific user using Cookies/Sessions or storing colors for user in table and assigning this color scheme when user login.
if its blue color theme user will get layout with blue color shades. (background is blue but font will be light blue like this)
You can define a variable like layout in CWebUser class for user when login retrive the latest if no then keep the default one! and override that in each controller or in each funtion in controller depends on your requirements. for this case i assume that you have limited number of color Scheme(define corresponding variable in Controler and load accordingly…)
It might be easiest to create a separate CSS file for each color option containing only color styles. You could include one of these based on the user’s settings after you include the standard theme CSS.
I’d suggest storing the user’s choice in the database (if they’re logged in) and a cookie, so the choice is remembered permanently for the authenticated user. The cookie can be used to apply the correct color choice before the user logs in.
This could become difficult to maintain as you add to the elements to the site. One option is to define each color as a CSS class and use these classes in your code.
For example in the CSS file (blue.css maybe):
.primary-background
{
background-color: #DDDDFF;
}
.secondary-background
{
background-color: #BBBBFF;
}
.inverse-background
{
background-color: #000055;
}
.primary, .secondary
{
color: black;
}
.inverse
{
color: white;
}
Then in the HTML:
<body class="primary-background primary">
...
</body>
I really don’t know if this is a good practise though. I’d be interested to hear other people’s thoughts.