Update I got it working!!!
I did this
Code:
if(max ~= 0) then
r, g, b = self.ColorGradient(min/max, unpack(self.colors.smooth))
end
and then
bar.value:SetFormattedText('|cff%02x%02x%02x%s|r.%s%%', r*255, g*255, b*255, numberize(cur), d)
which seems to be the same code as above but this works so hey presto I'm sorted!!
Thanks all.