Skip to content

Commit ee76275

Browse files
committed
Set rgb and hsv when hex change
1 parent 8b26236 commit ee76275

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/color-picker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ const ColorPicker = ({ color, onChange }) => {
3939
}
4040

4141
function changeHex(hex) {
42-
changeColor({ ...color, hex });
42+
const {r, g, b} = hex2rgb(hex);
43+
const {h, s, v} = rgb2hsv(r, g, b);
44+
changeColor({ ...color, r, g, b, h, s, v, hex });
4345
}
4446

4547
function handleHexKeyUp(e) {

0 commit comments

Comments
 (0)