diff --git a/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua b/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua index cb9de4153..cab2cfc6c 100644 --- a/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua +++ b/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua @@ -233,14 +233,32 @@ local function drawCanvasPixel(x, y) end end +local color_hex_lookup = {} +for i = 0, 15 do + color_hex_lookup[2 ^ i] = string.format("%x", i) +end + --[[ Converts each colour in a single line of the canvas and draws it returns: nil ]] local function drawCanvasLine(y) + local text, fg, bg = "", "", "" for x = 1, w - 2 do - drawCanvasPixel(x, y) + local pixel = getCanvasPixel(x, y) + if pixel then + text = text .. " " + fg = fg .. "0" + bg = bg .. color_hex_lookup[pixel or canvasColour] + else + text = text .. "\127" + fg = fg .. color_hex_lookup[canvasColour] + bg = bg .. color_hex_lookup[colours.grey] + end end + + term.setCursorPos(1, y) + term.blit(text, fg, bg) end --[[