From 7a74126c16f36a351c5b498de46026a2a58f5c83 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Mon, 22 Jul 2024 20:23:56 +0200 Subject: [PATCH] Add CreateColor method/wrapper --- modules/misc.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/misc.lua b/modules/misc.lua index 5c301fa..0148ff4 100644 --- a/modules/misc.lua +++ b/modules/misc.lua @@ -163,3 +163,13 @@ do return data end end + +--[[ namespace:CreateColor(r, g, b[, a]) +Wrapper for CreateColor that can handle >1-255 range as well. +--]] +function addon:CreateColor(r, g, b, a) + if r > 1 then r = r / 255 end + if g > 1 then g = g / 255 end + if b > 1 then b = b / 255 end + return CreateColor(r, g, b, a) +end