Using setImageDrawMode to invert sprites

I have been working on a puzzle game where I have a grid based puzzle, where I have clues (rendered as sprites) within blank pixels. When you select a clue, the pixel fills in, so I want to flip the colors of the clue so that it can still be seen.

When I was starting the project, I used numbers as placeholders, and used a function to convert the number to a "text sprite", which worked in conjunction with gfx.setImageDrawMode, but now that I am using png's for the sprites, it is no longer working.

I am positive that my png's are transparent, and am getting very confused as to why these lines aren't working like they did with the text version of the sprite:

gfx.setImageDrawMode(gfx.kDrawModeFillWhite)
local sprite = gfx.sprite.new(gfx.image.new("square.png"))
sprite:moveTo("location on grid")
sprite:add()

I was reading on another post that using:

gfx.sprite:setImageDrawMode(gfx.kDrawModeFillWhite) 

was a way to do this, but when I change that first line to this, I get an error that a spriteud is needed, despite passing gfx.kDrawModeFillWhite into it.

You need to run setImageDrawMode on the sprite and to invert sprites you want to use gfx.kDrawModeInverted, so something like this: sprite:setImageDrawMode(gfx.kDrawModeInverted)

EDIT: just so you know whenever you see a colon in the documentation for a function, that means you have to run that function on an instance of that class.