Usage for ColorPicker

Permalink Browser Info Environment
Hi,

Thanks for that awesome addon, this is an automatic purchase for all my projects - and before this was Block Designer.
However it seems the documentation on your website is not complete. I need a color picker as a block field and I noticed in your package code that you have one. I managed to use it and it works fine, but I don't know what configuration is available - I'm not familiar with the JS component used either.

I would need to :
- have the color as a 6 digit hex value
- set up a custom palette - ideally with separate rows
- hide the color wheel
- forbid the possibility of picking a color outside the palette

Is it possible with that field type ?

Type: Discussion
Status: Resolved
dangrth
View Replies:
ramonleenders replied on at Permalink Reply
ramonleenders
Hi there,

Thanks for the love towards both add-ons, much appreciated! :)

Of course, what you ask is possible. You happen to have found the one (1!) field type that's not in the documentation haha... Sorry for that!

Can you try this piece of code out?

Again, sorry for this missing out of the docs.

"myColorField" => [
            "type"       => "ColorPicker",
            "label"      => t("Some color picker"),
            "required"   => false,
            "searchable" => true,
            "config"     => [
                'preferred_format' => 'hex',
                'show_palette_only' => true,
                'show_palette' => true,
                'hide_after_palette_select' => true,
                'palette' => [
                    ['black', 'white', 'blanchedalmond','rgb(255, 128, 0);', 'hsv 100 70 50'],
                    ['red', 'yellow', 'green', 'blue', 'violet'],
                ],
            ],


Kind regards,
Ramon
dangrth replied on at Permalink Reply
dangrth
Awesome, it works great ! Thank you for the very quick reply, this is very appreciated and fully worth the price of the addon when working on a project with time constraints !
Now, I just have to find how to configure the colors of the C5 editor :)

concrete5 Environment Information

N/A

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.