Skip to content

Commit

Permalink
fix: hue shift bug
Browse files Browse the repository at this point in the history
ensure valid value range
  • Loading branch information
shutosg committed Aug 24, 2020
1 parent d52020d commit 502f4b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/Runtime/Extensions/ColorExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public static Vector3 ToHSV(this Color self)
}

public static Color ToRGB(this Vector3 hsv)
=> Color.HSVToRGB(hsv.x, hsv.y, hsv.z);
{
hsv.x = (hsv.x % 1 + 1) % 1;
hsv.y = Mathf.Clamp01(hsv.y);
hsv.z = Mathf.Clamp01(hsv.z);
return Color.HSVToRGB(hsv.x, hsv.y, hsv.z);
}
}
}

0 comments on commit 502f4b6

Please sign in to comment.