Install colorpicker plugin

How can I implement the exististing colorpicker-lugin in the template default.php?

1 Like

First, you have to install the plugin - if you did not do so already - by downloading the files and placing them in site/fields/color. Make sure that the php file has the same name as the folder, i.e. color.php. Then you add a field definition to your default.yml in site/blueprints:

    label: Pick a color
    type:  color

Now you are able to pick colors in the panel and save them in your content files. To access them in the default template:

<div style="background-color: <?= $page->color() ?>">This div will have the color you picked</div>