我正在开发一个带有PanelColorSettings组件的自定义Gutenberg块来设置背景色,下面是我的代码
<PanelColorSettings
title={ __( \'Color Settings\' ) }
colorSettings={ [
{
value: backgroundColor,
onChange: ( colorValue ) => setAttributes( { backgroundColor: colorValue } ),
label: __( \'Background Color\' ),
},
] }
>
</PanelColorSettings>
如何为backgroundColor属性指定颜色名称而不是颜色代码?默认返回值似乎是颜色代码,它在将来的颜色代码更新中无效,因为内容需要重新保存。