function col2hex(num) local hexstr = '0123456789abcdef' local s = '' for i=1, 6 do local mod = math.fmod(num, 16) s = string.sub(hexstr, mod+1, mod+1) .. s num = math.floor(num / 16) end return s end function colortostring(c) if c == 0xFFFFFF then return "white" end return col2hex(c) end w, h = img.width, img.height colors = {} for y=0, h-1 do colors[img.getInt(0, y)] = 1 colors[img.getInt(w-1, y)] = 1 end for x=0, w-1 do colors[img.getInt(x, 0)] = 1 colors[img.getInt(x, h-1)] = 1 end list, n = {}, 0 for color, _ in pairs(colors) do n=n+1 list[n] = color end if #list > 1 then return "multi-color border" else return "border color: "..colortostring(list[1]) end