• Resolved Jürgen

    (@trimension)


    I developed a block that consists of two parts:

    <figure>
         <div />
         <figcaption />
    </figure>

    With the help of the block support settings I can, for example, set the alignment, color, border and spacing for the container (figure) or, with some effort, for the DIV within the container. Now I would also like to be able to configure the description (figcaption). This is a RichText element (p) within the figcaption. For this text I would like to be able to set the alignment and color.

    I can set the alignment using the AlignmentToolbar. For the color settings I added a new panel in the sidebar in the Styles tab. I found two controls for the color settings:

    1. ColorPicker: This allows me to select an individual color, but the predefined color-palettes are not displayed for selection… and
    2. ColorPalette: This is an empty control that doesn’t show me any palettes. With the help of the color prop I can define my own palette, but of course that doesn’t make much sense. I would like to see the existing DEFAULT and THEME palettes displayed here, just like when block support is activated for the Block-Container.

    I found countless descriptions of how to define custom palettes, but not how to use the existing standard palettes, which is probably what you always want.

    Has anyone got an idea?

Viewing 1 replies (of 1 total)
  • Thread Starter Jürgen

    (@trimension)

    By chance I found another – unfortunately undocumented – variant.

    In the ‘@wordpress/block-editor’ module there is a component called ‘PanelColorSettings’. This creates a panel in the sidebar and the correspondingly configured color setting controls.

    This component does exactly what you expect here. It’s just a shame that you can’t find it… and that there’s no documentation about it…

    The whole framework is totally chaotic… there is no clear line and everything is constantly changing… Does anyone even see through it?

Viewing 1 replies (of 1 total)
  • The topic ‘ColorPicker and ColorPalettes’ is closed to new replies.