COLOR NAMES

Place where find documentation
Post Reply
User avatar
Electroguard
Posts: 1069
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 359 times
Been thanked: 386 times

COLOR NAMES

Post by Electroguard »

I guessed the vga colour name constants would be the same as existing ttl, but couldn't remember how to reach them, and couldn't find them in help topic or searches. Gradually remembered having similar problem long time ago and being told they were specifically buried deep under TFT DISPLAY ILI9341.
The info is already there, so if time permits it might be worth just giving them their own COLOR NAMES topic title in Help for easy finding (especially now they are valid for VGAOUT).

The colour marked SYBLUE needs changing to SKYBLUE B.T.W. (skyblue is recognised but syblue is not).
User avatar
cicciocb
Site Admin
Posts: 2516
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 531 times
Been thanked: 1788 times
Contact:

Re: COLOR NAMES

Post by cicciocb »

Ok robin, I already changed syblue but will be visible only in the next version of the help
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: COLOR NAMES

Post by lyizb »

I'm a year late to this thread, but just spent some time searching for the named colors (having discovered by experimentation that "tft.text.color red" works). I found them when I found this thread. They are: BLACK, NAVY, DARKGREEN, DARKCYAN, MAROON, PURPLE, OLIVE, LIGHTGREY, DARKGREY, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE, ORANGE, GREENYELLOW, PINK, BROWN, GOLD, SILVER, SKYBLUE, VIOLET.

In the TFT.TEXT.COLOR entry in the manual, it might be good to list or at least link to that list. Also that entry might refer to the function TFT.RGB.
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: COLOR NAMES

Post by lyizb »

From the manual:
Annex defined colors.jpg
I had hoped to be able to do "DIM c(24)=BLACK,NAVY,DARKGREEN,DARKCYAN, etc.", but that got a syntax error. Using TFT.COLOR(BLACK) works, so this

Code: [Local Link Removed for Guests]

'Define color lookup table
dim c(24)=tft.color(BLACK),tft.color(NAVY),tft.color(DARKGREEN),tft.color(DARKCYAN),tft.color(MAROON),tft.color(PURPLE),tft.color(OLIVE),tft.color(LIGHTGREY),tft.color(DARKGREY),tft.color(BLUE),tft.color(GREEN),tft.color(CYAN),tft.color(RED),tft.color(MAGENTA),tft.color(YELLOW),tft.color(WHITE),tft.color(ORANGE),tft.color(GREENYELLOW),tft.color(PINK),tft.color(BROWN),tft.color(GOLD),tft.color(SILVER),tft.color(SKYBLUE),tft.color(VIOLET)
hRes=160
vRes=128
nClr=24
for i=0 to nClr-1
  TFT.RECT i*hRes/nClr,0, hRes/nClr, vres, c(i), 1
next i
produces this on an ST7735:
ST7735 defined colors.jpg

Would it be reasonable to allow those defined colors directly as defined constants, as in the command, TFT.FILL red?

(Of course, it's possible that this would break some programs.)
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2516
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 531 times
Been thanked: 1788 times
Contact:

Re: COLOR NAMES

Post by cicciocb »

No, the actual implementation avoids to define too much constants.
This do not inhibit to define them by yourself, for example:
RED = tft.color(RED)
GREEN = tft.color(GREEN).


You can eventually put this in a library file and include it so this will not appear in your "main" code
Post Reply