diff --git a/editor/components/color-indicator/index.js b/editor/components/color-indicator/index.js
new file mode 100644
index 00000000000000..c0d35331c1e9a3
--- /dev/null
+++ b/editor/components/color-indicator/index.js
@@ -0,0 +1,28 @@
+/**
+ * WordPress dependencies
+ */
+import {
+ ColorIndicator,
+} from '@wordpress/components';
+import { sprintf } from '@wordpress/i18n';
+
+/**
+ * Internal dependencies
+ */
+import withColorContext from '../color-palette/with-color-context';
+import { getColorName } from '../colors';
+
+export default withColorContext( ( { colors, colorValue, ariaLabel } ) => {
+ if ( ! colorValue ) {
+ return null;
+ }
+
+ const colorName = getColorName( colors, colorValue );
+
+ return (
+
+ );
+} );
diff --git a/editor/components/color-palette/control.js b/editor/components/color-palette/control.js
new file mode 100644
index 00000000000000..73470afa477a6f
--- /dev/null
+++ b/editor/components/color-palette/control.js
@@ -0,0 +1,39 @@
+/**
+ * External dependencies
+ */
+import { pick } from 'lodash';
+
+/**
+ * WordPress dependencies
+ */
+import { BaseControl } from '@wordpress/components';
+
+/**
+ * Internal dependencies
+ */
+import './control.scss';
+import ColorPalette from './';
+import TextWithColorIndicators from '../text-with-color-indicators';
+
+const ColorPaletteControl = ( { label, ...props } ) => {
+ const labelElement = (
+
+ { label }
+
+ );
+
+ return (
+
+
+
+ );
+};
+
+export default ColorPaletteControl;
diff --git a/editor/components/color-palette/control.scss b/editor/components/color-palette/control.scss
new file mode 100644
index 00000000000000..48ef166e475164
--- /dev/null
+++ b/editor/components/color-palette/control.scss
@@ -0,0 +1,4 @@
+.editor-color-palette-control__color-palette {
+ margin-top: .6rem;
+ margin-bottom: 1.4rem;
+}
diff --git a/editor/components/panel-color-settings/index.js b/editor/components/panel-color-settings/index.js
index f85922104503f8..0b0eede1649a09 100644
--- a/editor/components/panel-color-settings/index.js
+++ b/editor/components/panel-color-settings/index.js
@@ -1,74 +1,29 @@
-/**
- * External dependencies
- */
-import { pick } from 'lodash';
-
/**
* WordPress dependencies
*/
import {
PanelBody,
- BaseControl,
- ColorIndicator,
} from '@wordpress/components';
-import { Fragment } from '@wordpress/element';
import { ifCondition, compose } from '@wordpress/compose';
-import { sprintf } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import './style.scss';
-import ColorPalette from '../color-palette';
+import ColorPaletteControl from '../color-palette/control';
+import TextWithColorIndicators from '../text-with-color-indicators';
import withColorContext from '../color-palette/with-color-context';
-import { getColorName } from '../colors';
-
-const ColorIndicatorWithColorContext = withColorContext( ( { value, colorIndicatorAriaLabel, colors } ) => {
- if ( ! value ) {
- return null;
- }
-
- const colorName = getColorName( colors, value );
-
- return (
-
- );
-} );
-
-const ColorPaletteControl = ( { label, ...settings } ) => {
- const labelElement = (
-
- { label }
- { }
-
- );
-
- return (
-
-
-
- );
-};
export function PanelColorSettings( { title, colorSettings, children } ) {
const className = 'editor-panel-color-settings';
const titleElement = (
-
+
{ title }
- { colorSettings.map(
- ( settings, index ) => (
-
- )
- ) }
-
+
);
return (
diff --git a/editor/components/panel-color-settings/style.scss b/editor/components/panel-color-settings/style.scss
index 204d263504ef3e..933c9063f79a56 100644
--- a/editor/components/panel-color-settings/style.scss
+++ b/editor/components/panel-color-settings/style.scss
@@ -10,9 +10,4 @@
&.is-opened &__panel-title .component-color-indicator {
display: none;
}
-
- &__color-palette {
- margin-top: .6rem;
- margin-bottom: 1.4rem;
- }
}
diff --git a/editor/components/panel-color-settings/test/__snapshots__/index.js.snap b/editor/components/panel-color-settings/test/__snapshots__/index.js.snap
index 1531b78fed4cb2..b4fca29bab2e2d 100644
--- a/editor/components/panel-color-settings/test/__snapshots__/index.js.snap
+++ b/editor/components/panel-color-settings/test/__snapshots__/index.js.snap
@@ -4,23 +4,27 @@ exports[`PanelColorSettings matches the snapshot 1`] = `
Test Title
-
-
-
+
}
>
(
+
+);
+
+const TextWithColorIndicators = ( { className, colorSettings, children } ) => (
+
+ { children }
+ { !! colorSettings && isArray( colorSettings ) ?
+ colorSettings.map( mapColorIndicator ) :
+ mapColorIndicator( colorSettings )
+ }
+
+);
+
+export default TextWithColorIndicators;