Hidden TFT (and GUI) Colour Names
Posted: Thu Sep 02, 2021 2:11 pm
I couldn't find it documented anywhere, but it appears that TFT and GUI items can recognise some pre-defined colour names.
For example: TFT.Fill RED (fills the screen red)
Similarly: GUI.Init 20, BLUE (followed by a gui.refresh, fills the screen blue)
They are not simply public variable names though, because eg: Wlog Blue causes a "No such variable " error.
There may be more, but some of the recognised colour names include the primary colours red, green and blue, along with black and white, plus cyan, yellow and magenta.
It is a handy hidden bonus… cos it's pretty much the standard colour names I would usually need to define myself anyway, eg:
There are some slight problems with the internal Annex colour names, such as pink being recognised but actually showing as white, and similarly orange being recognised but actually showing as yellow - but that doesn't prevent any of the colour names from being redefined as variables using tft.rgb(R,G,B) as in the snippet above.
I noticed this while using Annex32 1.43.5, so unless a list of available pre-defined colour names is officially added to the Online Help it should just be considered as a nice hidden bonus which might change in future updates.
For example: TFT.Fill RED (fills the screen red)
Similarly: GUI.Init 20, BLUE (followed by a gui.refresh, fills the screen blue)
They are not simply public variable names though, because eg: Wlog Blue causes a "No such variable " error.
There may be more, but some of the recognised colour names include the primary colours red, green and blue, along with black and white, plus cyan, yellow and magenta.
It is a handy hidden bonus… cos it's pretty much the standard colour names I would usually need to define myself anyway, eg:
Code: [Local Link Removed for Guests]
black=0: white=tft.rgb(255,255,255): red=tft.rgb(255,0,0): green=tft.rgb(0,255,0): blue=tft.rgb(0,0,255)
cyan=green+blue: pink=red+blue: yellow=red+green: orange=tft.rgb(255,165,0)
I noticed this while using Annex32 1.43.5, so unless a list of available pre-defined colour names is officially added to the Online Help it should just be considered as a nice hidden bonus which might change in future updates.