Skip to content

Commit

Permalink
Fix ColorPicker saturation and value being swapped
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPXL committed Jul 18, 2024
1 parent a3b006a commit c9fa762
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ui/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ export function ColorPicker({
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;

const v = x / rect.width;
const s = 1 - y / rect.height;
const s = x / rect.width;
const v = 1 - y / rect.height;

setHSV(hsvColor.h, s, v);
}}
Expand All @@ -149,8 +149,8 @@ export function ColorPicker({
).href
}
style={{
top: `${100 - hsvColor.s * 100}%`,
left: `${hsvColor.v * 100}%`
top: `${100 - hsvColor.v * 100}%`,
left: `${hsvColor.s * 100}%`
}}
draggable={false}
></img>
Expand Down

0 comments on commit c9fa762

Please sign in to comment.