Choosing color css themes via cmsB

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 18, 2014   (RSS)

By JeffC - September 18, 2014

I wanted to give my client the ability to choose some colors for their site, and here’s what I did so far (example changes the background color of a page)…

1. Created a multi record editor (I called it “Color Choices”) with only 2 text fields: Color (ie White) and HEX Color (ie FFFFFF). I created a record for each color I wanted to allow.

2. I then created a single record editor called “clients choices” and in that create a list field called “Page Background” that gets its options from the database “Color Choices” with the option values  from the “hex_color” field and the option labels from the “color_choices” field

3. Lastly, in my css.php file I inserted: body {background-color: #<?php echo $client_choicesRecord[‘page_background'] ?>;}

4. The concept can be used to change the colour of any css element.

The above solution works. However, now I’m thinking that my solution gives the client the option to make too many BAD choices (ie combinations of color that look horrible together), and I want to set up the system to where they can only choose a theme and it will automatically populate the appropriate fields.

For example a theme called 'red' might include a white background, black text and variations of red for link colour, highlighted link etc... So my basic css would look like this:

body {background-color: #FFFFFF;}
font {color:#000000;}
a {color: #FF0000;}
a:hover {color: #700000;}

Could any one help me develop my current solution to achieve my new objective. How would I set up the fields in cmsB and what would my css.php file look like?

Thanks

Jeff