Support Forum
Support › Meta Box Builder › Setting Custom Color Palettes via Field OptionsResolved
I've tried quite a few options for how to add custom palette colors via the Advanced tab of a Color Picker field, but none of them are working. It discusses how to set the color palettes here: https://docs.metabox.io/fields/color/. But, that's for coding it directly. Can I do the same through adding an option under the Advanced tab of the color picker?
Thanks!
Hi David,
You can use the Dot notation to define an array in the Builder. See my screenshot https://share.getcloudapp.com/eDuwwOG0.
Or use the JSON notation (array) ["#459", "#78b", "#ccc"]
. See https://share.getcloudapp.com/Wnullgw8.
That works perfectly, thank you.
Is it possible to do the same with the Background field in some way?
Hi,
The field background
has not supported the setting palettes
like the field color
yet. I'm going to create a feature request for the developer team to support this.
Thank you.
Hello Long,
could you please reupload the screenshots? They don't work any more.
Where do I enter the palette-values? Under "Color picker options" or under "Advanced / Custom settings"? Will the key be "js_options" or "palettes"?
Thanks.
Hi,
The key is palettes
in the Builder, here is the screenshot https://imgur.com/P6EfPVG
Thank you, Long.
I entered the values as shown but the palette is not changing. Does it maybe not work with multiple color pickers in the same block/field group?
Best
Jan
Hi Jan,
Can you please share the code that creates the field? And some screenshots of how it displays on your site?
Hi Long,
here is a screenshot of the color picker I test on:
I set like 12 colours in this group.
And here I am looking for the color palette. The first three colours should be Red, Black, Red. But it is the same palette as in every other color picker.
And here is the group field export:
https://www.dropbox.com/s/qvyoqxmixw1sccm/stundenplan.json?dl=0
Thanks for your support.
Jan
Hi,
I got it. In the builder, you should use the double quote instead of the single quote. Like this
["#f00","#000","#ccc"]
That's it.
Thank you Long!