Class to expand text "colour" selections

For no reason other than having the idea, I’ve created a class that inherits the Arduboy2 class and overrides the write() and drawChar() functions to give more options for the selection of text character and background “colours”.

Text functions behave the same as before except that, in addition to WHITE and BLACK, the setTextColor() and setTextBackground() functions will now accept values INVERT and TRANSPARENT.

Setting the text or background colour as INVERT will invert the corresponding pixels that exist in the screen buffer. White pixels will be changed to black, and black to white.

Setting the text or background colour as TRANSPARENT will leave the corresponding pixels in the screen buffer unchanged. With the original functions, setting both the text and background colours the same will make the background transparent. With this new method, the characters themselves (and still the background) can now be made transparent.

Now, setting the text and background to the same colour (including INVERT or TRANSPARENT) will do exactly as specified (which isn’t very useful).

The repository, including usage details in the file, is here:

Maybe it will be of use to someone…

1 Like