@@ -83,7 +83,12 @@ export const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerI
8383 const colorPickerButtonRef = React . useRef < HTMLButtonElement > ( null ! ) ;
8484 const { formatMessage } = useIntl ( ) ;
8585 const field = useField ( name ) ;
86- const color = field . value ?? '#000000' ;
86+
87+ /**
88+ * The color that will show in the field. We can't presume to show black or something
89+ * if no value is currently set (as `null` really corresponds to no color, not
90+ * black), so default to empty string if nothing else is available. */
91+ const color = field . value ?? props . placeholder ?? '' ;
8792
8893 const composedRefs = useComposedRefs ( forwardedRef , colorPickerButtonRef ) ;
8994
@@ -111,7 +116,7 @@ export const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerI
111116 < ColorPreview color = { color } />
112117 < Typography
113118 style = { { textTransform : 'uppercase' } }
114- textColor = { field . value ? undefined : 'neutral600 ' }
119+ textColor = { field . value ? undefined : 'neutral500 ' }
115120 variant = "omega"
116121 >
117122 { color }
@@ -139,7 +144,10 @@ export const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerI
139144 } ) }
140145 style = { { textTransform : 'uppercase' } }
141146 name = { name }
142- defaultValue = { color }
147+ // No default value. If nothing is selected, the input will be empty.
148+ defaultValue = { field . value ?? '' }
149+ // Here we default to #000000 as the placeholder, because, absent a
150+ // user defined placeholder, we want to indicate the desired format.
143151 placeholder = "#000000"
144152 onChange = { field . onChange }
145153 { ...props }
0 commit comments