Read the value with toHexString(). The callbacks pass a color object, not a string. Read it with .toHexString(), .toRgbString() or .toHsbString(). A string passed in works as it is.
- value and defaultValue take a hex string, an { r, g, b } or { h, s, b } object, or a color object.
- onChange(value, css) also passes the CSS string as its second argument.
- Use onChangeComplete for expensive updates. onChange fires on every move while dragging. onChangeComplete fires once on release, which suits a network write or a theme rebuild.
- In a form, store a string. Form.Item stores what onChange passes, which is a color object. Add getValueFromEvent={(color) => color.toHexString()} to keep a hex string.
- The color object also has .isGradient(), .getColors(), .equals(other) and .cleared.
- Keep one notation in your state and convert at the edges.