How to get color name in PanelColorSettings in custom Gutenberg block?

I could solve it with the function getColorObjectByColorValue (take a look at the gutenberg files).

If you have something like

const backgroundColors = [
        {
            name: 'Light Green',
            slug: 'light-green',
            color: '#E6F0F0'
        },
        {
            name: 'Light Gray',
            slug: 'light-gray',
            color: '#F7F7F7'
        }
    ];

then you can get the color name by

const test = getColorObjectByColorValue(backgroundColors, backgroundColor);
console.log(test.name);

Should also work with the default palette.

tech