Page 1 of 1

Colorconstants for all OS

Posted: Fri Apr 06, 2007 10:30 pm
by ts-soft
like the API constants: #White, #Black, #Gray as
#PB_White or #PB_Color_White

Posted: Sat Apr 07, 2007 12:18 am
by AND51
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

Posted: Tue Apr 10, 2007 9:08 am
by Rescator
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. :)

Re: Colorconstants for all OS

Posted: Tue Apr 10, 2007 9:27 am
by PB
I only use PureBasic on Windows, but it already has lots of colors defined:

Code: Select all

Debug #Black
Debug #White
Debug #Yellow
Debug #Red
Debug #Green
; etc
Do these not work on Linux or MacOS?

Posted: Tue Apr 10, 2007 10:07 am
by Rescator
Hmm, hey PB! Try defining #Black yourself, seems those are override able?
I certainly never noticed some PureBasic constants could do that. (looks at Fred) This a PB4 feature?

Posted: Tue Apr 10, 2007 10:53 am
by PB
> Try defining #Black yourself, seems those are override able?

Nope, these can't be overridden on the Windows version.

Re: Colorconstants for all OS

Posted: Tue Apr 10, 2007 11:13 am
by Trond
PB wrote:I only use PureBasic on Windows, but it already has lots of colors defined:

Code: Select all

Debug #Black
Debug #White
Debug #Yellow
Debug #Red
Debug #Green
; etc
Do these not work on Linux or MacOS?
They will "work" but they aren't defined because they are Windows API constants.

Rescator, the PB manual already has a colour table.

Re: Colorconstants for all OS

Posted: Tue Apr 10, 2007 2:08 pm
by Psychophanta
ts-soft wrote:like the API constants: #White, #Black, #Gray as
#PB_White or #PB_Color_White
Agree.
Or even better, disable those constants.

Posted: Tue Apr 10, 2007 2:58 pm
by Kaeru Gaman
i worked Colors.pbi over, works now correctly:
http://www.purebasic.fr/english/viewtopic.php?t=26615

Re: Colorconstants for all OS

Posted: Fri Aug 14, 2015 9:31 pm
by Andre
I think I've seen several threads about this already, but I want to support at least this topic in the wishlist :mrgreen:

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
Would be good, if this constants could be added to the next PB version :D