I'm looking for a way to retrieve the array of color objects you can set in the theme using add_theme_support('editor-color-palette', [...]);
Somehow I can not find any information in the documentation on how to retrieve the theme colors inside a custom block.
<ColorPalette
onChange={ value => onChange(index, 'color', value) }
/>
I need the array of colors inside the onChange callback to convert a hex color to the slug color name I've set inside php using the function getColorObjectByColorValue(themeColorsArray, callbackValueHexColor)
Thanks alot for your help!
Edit: Found the solution. There is a function inside wp.core called select. With this funciton you can retrieve the editor core object. To get the color do as followed:
wp.data.select( "core/editor" ).getEditorSettings().colors