From 174f479617f0d36ef8491a41fd860ef5b2fb795d Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 17 Aug 2024 04:58:19 +0200 Subject: [PATCH] fix: proper modulo for color selection --- src/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.lua b/src/utils.lua index 94f7f0e..9294e5f 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -11,7 +11,7 @@ local available_colors = { -- TODO these are definitely not portable! } local function color(x) - return available_colors[ (native.hash(x) % #available_colors) + 1 ] + return available_colors[ math.fmod(math.abs(native.hash(x)), #available_colors) + 1 ] end local function order_tuples(x) -- TODO send help...