Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS



39 Posts   8001 Views


20 December 2009 at 2:20am Community Member, 901 Posts

It all depends what you want to do with it. As I said: This module is just a color selector field in the CMS. What you do with the color is entirely up to you. As an example you could add something like this to your template:

<style type="text/css">
body { background:#$BgColor; }

This would then apply your selected color as Page Background...


20 December 2009 at 2:33am 4085 Posts

Hi, Roman,

Just a thought... Maybe your color picker module could come with its own field type, e.g.

static $db = array (
'MyColor' => 'Color'

$MyColor.RGB $MyColor.Hex.. etc..

function scaffoldFormField() { return new ColorPicker(... etc); }


20 December 2009 at 2:34am Community Member, 17 Posts



How to use the "background Color" to Content of each page that I created?

Is there a way to add color to my Contents?



20 December 2009 at 2:40am Community Member, 901 Posts

@UncleCheese: Yeah, the own field-type for colors might be a good idea. I'll probably integrate this for a SS 2.4 release.

@Mikan: I gave you enough information to change the background color for each of your pages... you should go through the tutorials and get familiar with SilverStripe. People won't write all the code for you here.


20 December 2009 at 2:40am 4085 Posts

I think this is what you want?

<div style="background:#$BackgroundColor">$Content</div>

You're a braver man than I. I don't think I would ever empower my clients to have control over background colors. Yikes.


20 December 2009 at 2:49am Community Member, 901 Posts

@UncleCheese It depends on who your client is really. I used this for my own website, and also for websites of graphic-designers. But it's not something i'd recommend to everybody :)

@Mikan Since the field name is BgColor, you should use that in the template ($BgColor). I already wrote how to change the background color some posts before, even before you asked. Don't know what else you need to know..


3 February 2010 at 11:05am Community Member, 168 Posts

This is a brilliant addition! Exactly what I needed, many thanks Banal


14 April 2010 at 11:23am Community Member, 19 Posts

Firstly this is amazing. Gave me exactly what I was looking. Must admit I was sweating when I told my client I could do this - then found your colour picker code! Worked a treat. Well until I ran into a problem with it not displaying within a CMS Pop-up. This is actually quite confusing as i have it working fine on my local machine running XAMPP but now that it is on a live hosting server it isn't. It's just displaying the text field. I have it working elsewhere in the CMS just not in a pop-up though.

Any ideas as I'm stumped?!