Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

round the hsv to rgb results a little more nicely for integer RGB

  • Loading branch information...
commit 87039ee865896973d976822652c93e9461330039 1 parent 28769ac
Tony Cook authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 color.c
View
9 color.c
@@ -173,13 +173,14 @@ void i_hsv_to_rgb(i_color *color) {
}
else {
int i;
- double f, m, n, k;
+ double f;
+ int m, n, k;
h = h / 255.0 * 6;
i = h;
f = h - i;
- m = v * (255 - s) / 255;
- n = v * (255 - s * f) / 255;
- k = v * (255 - s * (1 - f)) / 255;
+ m = 0.5 + v * (255 - s) / 255;
+ n = 0.5 + v * (255 - s * f) / 255;
+ k = 0.5 + v * (255 - s * (1 - f)) / 255;
switch (i) {
case 0:
color->rgb.r = v; color->rgb.g = k; color->rgb.b = m;
Please sign in to comment.
Something went wrong with that request. Please try again.