Custom background color in files section

I’m using the awesome Color Palette plugin to assign colors to pages and use these in templates, and I’d also like to show these colors in the pages sections in the panel. Is there a way to do this?

Yes, that is possible with a page model that returns some html with a class or inline styles

Example, assuming you have a field pageColor:

class NotePage extends Page
    public function color()
        $html = '<span class="'. $this->pagecolor() .'"></span>';
        return $html;

Then in info:

info: "{{ page.color }}"

Thanks. And sorry, I forgot to mention that I’d like this color to show up as background color in the icon/image part of the page item. I don’t suppose that info is doing that, right?

I see, no, the icon/image part is controlled via the image option and can have either an icon or an image.

I see basically two options:

  • a custom pages section that puts a color swatch where the image/icon should be
  • a method that generates a mini-image from the color value and use that as the image