Colorconstants for all OS
Colorconstants for all OS
like the API constants: #White, #Black, #Gray as
#PB_White or #PB_Color_White
#PB_White or #PB_Color_White
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

I would appreciate the most shortest notation.
Furthemore, I would like to see the most/all colors, that also exist in HTML.
For example aqua, lightskyblue, whitesmoke, lime, etc.
To achive this, I could start creating a list in CSV Format for easier copying, if you want!
Example notation:
#PB_Constant;HTML color name;hex notation;RGB() notation
Furthemore, I would like to see the most/all colors, that also exist in HTML.
For example aqua, lightskyblue, whitesmoke, lime, etc.
To achive this, I could start creating a list in CSV Format for easier copying, if you want!
Example notation:
#PB_Constant;HTML color name;hex notation;RGB() notation
PB 4.30
Code: Select all
onErrorGoto(?Fred)
If you want it as part of PB itself I suggest:
(Note! Intel/LSB (BGR) order which is "wrong" when compared to the proper Motorola/MSB/Network (RGB) order. blame it on intel for being anal and motorola for loosing the PC market to intel)
#PB_Color_White=$FFFFFF
#PB_Color_Grey=$7F7F7F
#PB_Color_Gray=#PB_Color_Grey
#PB_Color_Black=$000000
#PB_Color_Red=$0000FF
#PB_Color_Blue=$FF0000
#PB_Color_Green=$00FF00
And so on, anything else could conflict with user constants.
It also sticks to the constant naming scheme of PB.
I would really hate to get "Constant already declared with a different value"
errors when trying to do
#Red=$2140FE
or for example
#Color_Red=$2140FE
in a game or program I'm making.
And I would not want #PB_White or similar to that
as that would make the auto complete/list in the IDE a pain to scroll through as the colors would be spread ungrouped between all the other constants.
In a ironic twist, I would not mind typing #PB_Color_Red but I also happen to know how to write RGB well enough to know what colors I get when I "mix" the hexes so I do not really need the constants.
But when trying to match "web" colors yeah it might be nice, but there is already some awesome web (and other types) of color charts on the net which is only a copy'n'paste away really.
PS! A nice color table could be added to the PB manual however! With RGB and BGR (LSB) ordered hex values for direct copy'n'paste.
(Note! Intel/LSB (BGR) order which is "wrong" when compared to the proper Motorola/MSB/Network (RGB) order. blame it on intel for being anal and motorola for loosing the PC market to intel)
#PB_Color_White=$FFFFFF
#PB_Color_Grey=$7F7F7F
#PB_Color_Gray=#PB_Color_Grey
#PB_Color_Black=$000000
#PB_Color_Red=$0000FF
#PB_Color_Blue=$FF0000
#PB_Color_Green=$00FF00
And so on, anything else could conflict with user constants.
It also sticks to the constant naming scheme of PB.
I would really hate to get "Constant already declared with a different value"
errors when trying to do
#Red=$2140FE
or for example
#Color_Red=$2140FE
in a game or program I'm making.
And I would not want #PB_White or similar to that
as that would make the auto complete/list in the IDE a pain to scroll through as the colors would be spread ungrouped between all the other constants.
In a ironic twist, I would not mind typing #PB_Color_Red but I also happen to know how to write RGB well enough to know what colors I get when I "mix" the hexes so I do not really need the constants.
But when trying to match "web" colors yeah it might be nice, but there is already some awesome web (and other types) of color charts on the net which is only a copy'n'paste away really.
PS! A nice color table could be added to the PB manual however! With RGB and BGR (LSB) ordered hex values for direct copy'n'paste.

Re: Colorconstants for all OS
I only use PureBasic on Windows, but it already has lots of colors defined:
Do these not work on Linux or MacOS?
Code: Select all
Debug #Black
Debug #White
Debug #Yellow
Debug #Red
Debug #Green
; etc
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Colorconstants for all OS
They will "work" but they aren't defined because they are Windows API constants.PB wrote:I only use PureBasic on Windows, but it already has lots of colors defined:
Do these not work on Linux or MacOS?Code: Select all
Debug #Black Debug #White Debug #Yellow Debug #Red Debug #Green ; etc
Rescator, the PB manual already has a colour table.
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: Colorconstants for all OS
Agree.ts-soft wrote:like the API constants: #White, #Black, #Gray as
#PB_White or #PB_Color_White
Or even better, disable those constants.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
i worked Colors.pbi over, works now correctly:
http://www.purebasic.fr/english/viewtopic.php?t=26615
http://www.purebasic.fr/english/viewtopic.php?t=26615
oh... and have a nice day.
- Andre
- PureBasic Team
- Posts: 2137
- Joined: Fri Apr 25, 2003 6:14 pm
- Location: Germany (Saxony, Deutscheinsiedel)
- Contact:
Re: Colorconstants for all OS
I think I've seen several threads about this already, but I want to support at least this topic in the wishlist
Some simple things like #White, #Black, etc. constants (already defined on Windows) should be pre-defined on all OSes, as now more and more codes are released which are fully cross-platform, but the color constants don't work on MacOS / Linux.
This would avoid such additional codes, which every user on MacOS / Linux need to manually add:
Would be good, if this constants could be added to the next PB version 

Some simple things like #White, #Black, etc. constants (already defined on Windows) should be pre-defined on all OSes, as now more and more codes are released which are fully cross-platform, but the color constants don't work on MacOS / Linux.
This would avoid such additional codes, which every user on MacOS / Linux need to manually add:
Code: Select all
CompilerIf Not Defined(White, #PB_Constant)
#White = $EEEEEE
CompilerEndIf
