diff --git a/nuklear.h b/nuklear.h index 4abcbc1ad..25a3e14e9 100644 --- a/nuklear.h +++ b/nuklear.h @@ -7662,9 +7662,9 @@ nk_rgb_factor(struct nk_color col, const float factor) { if (factor == 1.0f) return col; - col.r *= factor; - col.g *= factor; - col.b *= factor; + col.r = (nk_byte)(col.r * factor); + col.g = (nk_byte)(col.g * factor); + col.b = (nk_byte)(col.b * factor); return col; } NK_API struct nk_color diff --git a/src/nuklear_color.c b/src/nuklear_color.c index 17969f355..d73da63bf 100644 --- a/src/nuklear_color.c +++ b/src/nuklear_color.c @@ -27,9 +27,9 @@ nk_rgb_factor(struct nk_color col, const float factor) { if (factor == 1.0f) return col; - col.r *= factor; - col.g *= factor; - col.b *= factor; + col.r = (nk_byte)(col.r * factor); + col.g = (nk_byte)(col.g * factor); + col.b = (nk_byte)(col.b * factor); return col; } NK_API struct nk_color