That makes sense.
So just to let you know what I came up with I wrapped the colour comparison in a function so I can check it against the Colour Codes (the ones I specifically use I mean) stored as tables eg:
G = {0, 154/255, 5/255}
So ReturnColour(“G”, “Dark”) returns {0, 154/255, 5/255}
function ColourMatchVertex(FrameToCheck, ColourCode)
-- Used to compare the vertex colour of a frame.texture to the colour codes I'm using
local ColourCodeRGB = ReturnColour(ColourCode, "Dark");
local CCR = round(ColourCodeRGB[1], 3);
local CCG = round(ColourCodeRGB[2], 3);
local CCB = round(ColourCodeRGB[3], 3);
local ObR, ObG, ObB, ObA = FrameToCheck.Texture:GetVertexColour();
ObR = round(ObR, 3);
ObG = round(ObG, 3);
ObB = round(ObB, 3);
if CCR == ObR and CCG == ObG and CCB == ObB then
return true;
end
end
I wouldn’t be surprised if there’s a better way to do it but it seems to work. Thanks again to both of you, you’ve been a great help.
In case any other newbies like me stumble across this code, copy paste it and wonder why it doesn’t work…
round() and ReturnColour() are custom functions too.
function round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
And ReturnColour is because I’m trying to integrate Theme (aka skins, aka custom colour schemes) into my addon.
function ReturnColour(ColourLetter, Theme)
local ColorTable = {};
if Theme == "Dark" then
ColorTable = {
R = {128/255, 0 , 0},
G = {0, 154/255, 5/255},
D = {99/255, 102/255, 106/255},
Y = {251/255, 219/255, 101/255},
W = {1, 1, 1}
};
else
ColorTable = {
R = {128/255, 0 , 0},
G = {0, 154/255, 5/255},
D = {99/255, 102/255, 106/255},
Y = {251/255, 219/255, 101/255},
W = {1, 1, 1}
};
end
return ColorTable[ColourLetter];
end
And yes being AU English speaking Colour -v- Color continuously causes me grief.