Jump to:

5537 Posts in 1737 Topics by 1223 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Color-picker?

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5
Go to End
Author Topic: 7886 Views
  • banal
    Avatar
    Community Member
    901 Posts

    Re: Color-picker? Link to this post

    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 Page.ss template:

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

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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Color-picker? Link to this post

    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); }

  • Mikan
    Avatar
    Community Member
    17 Posts

    Re: Color-picker? Link to this post

    oh,

    unfortunately,

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

    Is there a way to add color to my Contents?

    Thanks

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Color-picker? Link to this post

    @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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Color-picker? Link to this post

    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.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Color-picker? Link to this post

    @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..

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Color-picker? Link to this post

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

  • go2planC
    Avatar
    Community Member
    19 Posts

    Re: Color-picker? Link to this post

    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?!

    7886 Views
Page: 1 2 3 4 5
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.