From f2b9cebc46988b714214c880a8e35ed9d56fde75 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 26 Dec 2022 10:51:36 -0300 Subject: [PATCH] Framework update --- Libs/DF/fw.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 6c7e9dd4..cf1f4b43 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 407 +local dversion = 408 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -757,6 +757,19 @@ function DF:SetFontRotation(fontString, degrees) end end +function DF:AddColorToText(text, color) --wrap text with a color + local r, g, b = DF:ParseColors(color) + if (not r) then + return text + end + + local hexColor = DF:FormatColor("hex", r, g, b) + + text = "|c" .. hexColor .. text .. "|r" + + return text +end + function DF:AddClassColorToText(text, className) if (type(className) ~= "string") then return DF:RemoveRealName(text) @@ -1246,6 +1259,7 @@ end --convert a any format of color to any other format of color function DF:FormatColor(newFormat, r, g, b, a, decimalsAmount) + a = a or 1 r, g, b, a = DF:ParseColors(r, g, b, a) decimalsAmount = decimalsAmount or 4