Wordpress - How to use PanelColorSettings in custom Gutenberg block?
First you need to import the component -
const {
PanelColorSettings,
} = wp.editor;
then inside the InspectorControls you call the component
<PanelColorSettings
title={ __( 'Color Settings' ) }
colorSettings={ [
{
value: color,
onChange: ( colorValue ) => setAttributes( { color: colorValue } ),
label: __( 'Background Color' ),
},
{
value: textColor,
onChange: ( colorValue ) => setAttributes( { textColor: colorValue } ),
label: __( 'Text Color' ),
},
] }
>
</PanelColorSettings>