Typically, the 13 colour pickers ought to be sufficient. As well as, react-color
permits us to create personalized colour pickers.
Within the following src/App.js
, we construct controls for the colour continuum (the Hue
part) and colour spectrum (the Saturation
part).
Line 1 imports CustomPicker
, a excessive order part, to make any customized colour picker. It’s used at line 32.
Line 2 imports the builtin parts, Hue
and Saturation
.
With the wrapper of CustomPicker
, the App is handed in with hex
, rgb
, hsl
, hsl
, and onChange
(line 4, the place rgb
isn’t used for this code).
Hue
is displayed at traces 13–15.
Saturation
is displayed at traces 16–18.
The oval (traces 19–27) makes use of the hex
worth for the background.
Execute the code by npm begin
. We see the next UI.
Nonetheless, clicking on hue or saturation doesn’t set off any colour adjustments.
What occurred?
It seems that react-color
model 2.19.3
has bugs. Downgrading to model 2.17.1 fixes the problem.