Skip to content

Commit f086a0a

Browse files
authored
Merge pull request #45 from raqso/fix/changing-hex-input-doesnt-update-color
Fix changing rgb and hsv when changing hex
2 parents 8b26236 + ee76275 commit f086a0a

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)