Setting Custom Color Palettes via Field Options

Support MB Builder Setting Custom Color Palettes via Field OptionsResolved

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #23503
    David NewtonDavid Newton
    Participant

    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!

    #23504
    Long NguyenLong Nguyen
    Moderator

    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.

    #23510
    David NewtonDavid Newton
    Participant

    That works perfectly, thank you.

    Is it possible to do the same with the Background field in some way?

    #23514
    Long NguyenLong Nguyen
    Moderator

    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.

    #32949
    JCJC
    Participant

    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.

    #32950
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The key is palettes in the Builder, here is the screenshot https://imgur.com/P6EfPVG

    #32984
    JCJC
    Participant

    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

    #32990
    Long NguyenLong Nguyen
    Moderator

    Hi Jan,

    Can you please share the code that creates the field? And some screenshots of how it displays on your site?

    #32993
    JCJC
    Participant

    Hi Long,

    here is a screenshot of the color picker I test on:

    https://prnt.sc/25zmbla

    I set like 12 colours in this group.

    https://prnt.sc/25zmmls

    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.

    https://prnt.sc/25zmrhx

    And here is the group field export:

    https://www.dropbox.com/s/qvyoqxmixw1sccm/stundenplan.json?dl=0

    Thanks for your support.

    Jan

    #33004
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I got it. In the builder, you should use the double quote instead of the single quote. Like this

    ["#f00","#000","#ccc"]

    #33015
    JCJC
    Participant

    That's it.

    Thank you Long!

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.