From 4240f4eb39bff223b9b0a92496d61ecd12ffc72d Mon Sep 17 00:00:00 2001 From: Athozus Date: Sun, 5 Nov 2023 17:04:29 +0100 Subject: [PATCH] Round numbers to avoid eventual float in string.format --- util/colors.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/colors.lua b/util/colors.lua index 99b8cfe..d17c454 100644 --- a/util/colors.lua +++ b/util/colors.lua @@ -32,9 +32,9 @@ local function rgbColorsMix(colors) G = G + c.g B = B + c.b end - R = R / #colors - G = G / #colors - B = B / #colors + R = math.floor(R / #colors + 0.5) + G = math.floor(G / #colors + 0.5) + B = math.floor(B / #colors + 0.5) return {r=R,g=G,b=B} end