Make all non-API constants/structures available on all OS

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Make all non-API constants/structures available on all OS

Post by Andre »

Currently there are a lot of example sourcecodes flying around, mainly made for Windows and therefore using the constants/structures available in PB for this OS.

If you want to use the same source on MacOS and/or Linux you often have to adapt it, e.g. change the color constants like available on Windows to their native values.

This could be avoided, if constants like the following ones are pre-defined on each OS:

Code: Select all

#White = $FFFFFF
#Red = $0000FF
#Green = $00FF00
#Blue = $FF0000
...
So my request is: made "universal" constants (and structures....), which are not related to a specific OS API, available in each PB version, also on MacOS and Linux. Thanks!

More examples than the color constants can be added to this thread :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Make all non-API constants/structures available on all O

Post by BorisTheOld »

I agree.

Please put all platform-specific references in separate sections -- one section for each platform. And please provide the same cross-platform constants for all platforms.

For a cross-platform language, too much of the documentation is Windows-centric. It's very confusing. And some of it even seems obsolete or outdated.

To some extent, these comments also apply to the forums. When providing solutions, forum members don't make it clear that sample code is platform specific. And the place to report documentation bugs is in the "Bugs - Windows" section, even if they relate to Linux or Mac.

A lot of this confusion seems to have evolved over the years. But now that all three platforms are being fully supported it's probably a good time to clean up the documentation, constants, etc, before adding a lot of new language features.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Re: Make all non-API constants/structures available on all O

Post by Guimauve »

A little brick added to this feature request, colors constants :

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : Standard Color Contants
; File Name : Standard Color Contants.pb
; File version: 1.0.0
; Programming : OK
; Programmed by : Guimauve
; Date : 05-10-2012
; Last Update : 05-10-2012
; PureBasic code : 5.00 B4
; Platform : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Programming notes : 
;
; Source for color names : 
; http://www.w3schools.com/tags/ref_colornames.asp
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Red color shades <<<<<

#IndianRed = $CD5C5C
#LightCoral = $F08080
#Salmon = $FA8072
#DarkSalmon = $E9967A
#LightSalmon = $FFA07A
#Crimson = $DC143C
#Red = $FF0000
#FireBrick = $B22222
#DarkRed = $8B0000

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Pink color shades <<<<<

#Pink = $FFC0CB
#LightPink = $FFB6C1
#HotPink = $FF69B4
#DeepPink = $FF1493
#MediumVioletRed = $C71585
#PaleVioletRed = $DB7093

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Orange color shades <<<<<

#LightSalmon = $FFA07A
#Coral = $FF7F50
#Tomato = $FF6347
#OrangeRed = $FF4500
#DarkOrange = $FF8C00
#Orange = $FFA500

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Yellow color shades <<<<<

#Gold = $FFD700
#Yellow = $FFFF00
#LightYellow = $FFFFE0
#LemonChiffon = $FFFACD
#LightGoldenrodYellow = $FAFAD2
#PapayaWhip = $FFEFD5
#Moccasin = $FFE4B5
#PeachPuff = $FFDAB9
#PaleGoldenrod = $EEE8AA
#Khaki = $F0E68C
#DarkKhaki = $BDB76B

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Purple color shades <<<<<

#Lavender = $E6E6FA
#Thistle = $D8BFD8
#Plum = $DDA0DD
#Violet = $EE82EE
#Orchid = $DA70D6
#Fuchsia = $FF00FF
#Magenta = $FF00FF
#MediumOrchid = $BA55D3
#MediumPurple = $9370DB
#Amethyst = $9966CC
#BlueViolet = $8A2BE2
#DarkViolet = $9400D3
#DarkOrchid = $9932CC
#DarkMagenta = $8B008B
#Purple = $800080
#Indigo = $4B0082
#SlateBlue = $6A5ACD
#DarkSlateBlue = $483D8B
#MediumSlateBlue = $7B68EE

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Green color shades <<<<<

#GreenYellow = $ADFF2F
#Chartreuse = $7FFF00
#LawnGreen = $7CFC00
#Lime = $00FF00
#LimeGreen = $32CD32
#PaleGreen = $98FB98
#LightGreen = $90EE90
#MediumSpringGreen = $00FA9A
#SpringGreen = $00FF7F
#MediumSeaGreen = $3CB371
#SeaGreen = $2E8B57
#ForestGreen = $228B22
#Green = $008000
#DarkGreen = $006400
#YellowGreen = $9ACD32
#OliveDrab = $6B8E23
#Olive = $808000
#DarkOliveGreen = $556B2F
#MediumAquamarine = $66CDAA
#DarkSeaGreen = $8FBC8F
#LightSeaGreen = $20B2AA
#DarkCyan = $008B8B
#Teal = $008080

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Blue color shades <<<<<

#Aqua = $00FFFF
#Cyan = $00FFFF
#LightCyan = $E0FFFF
#PaleTurquoise = $AFEEEE
#Aquamarine = $7FFFD4
#Turquoise = $40E0D0
#MediumTurquoise = $48D1CC
#DarkTurquoise = $00CED1
#CadetBlue = $5F9EA0
#SteelBlue = $4682B4
#LightSteelBlue = $B0C4DE
#PowderBlue = $B0E0E6
#LightBlue = $ADD8E6
#SkyBlue = $87CEEB
#LightSkyBlue = $87CEFA
#DeepSkyBlue = $00BFFF
#DodgerBlue = $1E90FF
#CornflowerBlue = $6495ED
#MediumSlateBlue = $7B68EE
#RoyalBlue = $4169E1
#Blue = $0000FF
#MediumBlue = $0000CD
#DarkBlue = $00008B
#Navy = $000080
#MidnightBlue = $191970

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Brown color shades <<<<<

#Cornsilk = $FFF8DC
#BlanchedAlmond = $FFEBCD
#Bisque = $FFE4C4
#NavajoWhite = $FFDEAD
#Wheat = $F5DEB3
#BurlyWood = $DEB887
#Tan = $D2B48C
#RosyBrown = $BC8F8F
#SandyBrown = $F4A460
#Goldenrod = $DAA520
#DarkGoldenrod = $B8860B
#Peru = $CD853F
#Chocolate = $D2691E
#SaddleBrown = $8B4513
#Sienna = $A0522D
#Brown = $A52A2A
#Maroon = $800000

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< White color shades <<<<<

#White = $FFFFFF
#Snow = $FFFAFA
#Honeydew = $F0FFF0
#MintCream = $F5FFFA
#Azure = $F0FFFF
#AliceBlue = $F0F8FF
#GhostWhite = $F8F8FF
#WhiteSmoke = $F5F5F5
#Seashell = $FFF5EE
#Beige = $F5F5DC
#OldLace = $FDF5E6
#FloralWhite = $FFFAF0
#Ivory = $FFFFF0
#AntiqueWhite = $FAEBD7
#Linen = $FAF0E6
#LavenderBlush = $FFF0F5
#MistyRose = $FFE4E1

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Grey color shades <<<<<

#Gainsboro = $DCDCDC
#LightGrey = $D3D3D3
#Silver = $C0C0C0
#DarkGrey = $A9A9A9
#Gray = $808080
#DimGrey = $696969
#LightSlateGrey = $778899
#SlateGrey = $708090
#DarkSlateGrey = $2F4F4F
#Black = $000000

; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
Feel free to add any colors you want.

Best regards
Guimauve
Dear Optimist, Pessimist,
and Realist,

While you guys were
busy arguing about the
glass of water, I DRANK IT !

Sincerely,
the Opportunist
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Make all non-API constants/structures available on all O

Post by ts-soft »

+ 1

Code: Select all

; List of common colors (rgb values)

; source:
; http://en.wikipedia.org/wiki/List_of_colors
; http://en.wikipedia.org/wiki/X11_color_names
; http://www.cryer.co.uk/resources/javascript/html2.htm

#PB_color_aliceblue              = $F0F8FF
#PB_color_antiquewhite           = $FAEBD7
#PB_color_aqua                   = $00FFFF
#PB_color_aquamarine             = $7FFFD4
#PB_color_azure                  = $F0FFFF
#PB_color_beige                  = $F5F5DC
#PB_color_bisque                 = $FFE4C4
#PB_color_black                  = $000000
#PB_color_blanchedalmond         = $FFEBCD
#PB_color_blue                   = $0000FF
#PB_color_blueviolet             = $8A2BE2
#PB_color_brown                  = $A52A2A
#PB_color_burlywood              = $DEB887
#PB_color_cadetblue              = $5F9EA0
#PB_color_chartreuse             = $7FFF00
#PB_color_chocolate              = $D2691E
#PB_color_coral                  = $FF7F50
#PB_color_cornflowerblue         = $6495ED
#PB_color_cornsilk               = $FFF8DC
#PB_color_crimson                = $DC143C
#PB_color_cyan                   = $00FFFF
#PB_color_darkblue               = $00008B
#PB_color_darkcyan               = $008B8B
#PB_color_darkgoldenrod          = $B8860B
#PB_color_darkgray               = $A9A9A9
#PB_color_darkgreen              = $006400
#PB_color_darkkhaki              = $BDB76B
#PB_color_darkmagenta            = $8B008B
#PB_color_darkoliveGreen         = $556B2F
#PB_color_darkorange             = $FF8C00
#PB_color_darkorchid             = $9932CC
#PB_color_darkred                = $8B0000
#PB_color_darksalmon             = $E9967A
#PB_color_darkseaGreen           = $8FBC8F
#PB_color_darkslateBlue          = $483D8B
#PB_color_darkslateGray          = $2F4F4F
#PB_color_darkturquoise          = $00CED1
#PB_color_darkviolet             = $9400D3
#PB_color_deeppink               = $FF1493
#PB_color_deepskyblue            = $00BFFF
#PB_color_dimgray                = $696969
#PB_color_dodgerblue             = $1E90FF
#PB_color_firebrick              = $B22222
#PB_color_floralwhite            = $FFFAF0
#PB_color_forestgreen            = $228B22
#PB_color_fuchsia                = $FF00FF
#PB_color_gainsboro              = $DCDCDC
#PB_color_ghostwhite             = $F8F8FF
#PB_color_gold                   = $FFD700
#PB_color_goldenrod              = $DAA520
#PB_color_gray                   = $808080
#PB_color_green                  = $008000
#PB_color_greenyellow            = $ADFF2F
#PB_color_honeydew               = $F0FFF0
#PB_color_hotpink                = $FF69B4
#PB_color_indianred              = $CD5C5C
#PB_color_indigo                 = $4B0082
#PB_color_ivory                  = $FFFFF0
#PB_color_khaki                  = $F0E68C
#PB_color_lavender               = $E6E6FA
#PB_color_lavenderblush          = $FFF0F5
#PB_color_lawngreen              = $7CFC00
#PB_color_lemonchiffon           = $FFFACD
#PB_color_lightblue              = $ADD8E6
#PB_color_lightcoral             = $F08080
#PB_color_lightcyan              = $E0FFFF
#PB_color_lightgoldenrodyellow   = $FAFAD2
#PB_color_lightgreen             = $90EE90
#PB_color_lightgrey              = $D3D3D3
#PB_color_lightpink              = $FFB6C1
#PB_color_lightsalmon            = $FFA07A
#PB_color_lightseagreen          = $20B2AA
#PB_color_lightskyblue           = $87CEFA
#PB_color_lightslategray         = $778899
#PB_color_lightsteelblue         = $B0C4DE
#PB_color_lightyellow            = $FFFFE0
#PB_color_lime                   = $00FF00
#PB_color_limegreen              = $32CD32
#PB_color_linen                  = $FAF0E6
#PB_color_magenta                = $FF00FF
#PB_color_maroon                 = $800000
#PB_color_mediumaquamarine       = $66CDAA
#PB_color_mediumblue             = $0000CD
#PB_color_mediumorchid           = $BA55D3
#PB_color_mediumpurple           = $9370DB
#PB_color_mediumseagreen         = $3CB371
#PB_color_mediumslatenlue        = $7B68EE
#PB_color_mediumspringgreen      = $00FA9A
#PB_color_mediumturquoise        = $48D1CC
#PB_color_mediumvioletred        = $C71585
#PB_color_midnightblue           = $191970
#PB_color_mintcream              = $F5FFFA
#PB_color_mistyrose              = $FFE4E1
#PB_color_moccasin               = $FFE4B5
#PB_color_navajowhite            = $FFDEAD
#PB_color_navy                   = $000080
#PB_color_oldlace                = $FDF5E6
#PB_color_olive                  = $808000
#PB_color_olivedrab              = $6B8E23
#PB_color_orange                 = $FFA500
#PB_color_orangered              = $FF4500
#PB_color_orchid                 = $DA70D6
#PB_color_palegoldenrod          = $EEE8AA
#PB_color_palegoldenrod          = $EEE8AA
#PB_color_palegreen              = $98FB98
#PB_color_paleturquoise          = $AFEEEE
#PB_color_palevioletred          = $DB7093
#PB_color_papayawhip             = $FFEFD5
#PB_color_peachpuff              = $FFDAB9
#PB_color_peru                   = $CD853F
#PB_color_pink                   = $FFC0CB
#PB_color_plum                   = $DDA0DD
#PB_color_powderblue             = $B0E0E6
#PB_color_purple                 = $800080
#PB_color_red                    = $FF0000
#PB_color_rosybrown              = $BC8F8F
#PB_color_royalblue              = $4169E1
#PB_color_saddlebrown            = $8B4513
#PB_color_salmon                 = $FA8072
#PB_color_sandybrown             = $F4A460
#PB_color_seagreen               = $2E8B57
#PB_color_seashell               = $FFF5EE
#PB_color_sienna                 = $A0522D
#PB_color_silver                 = $C0C0C0
#PB_color_skyblue                = $87CEEB
#PB_color_slateblue              = $6A5ACD
#PB_color_slategray              = $708090
#PB_color_snow                   = $FFFAFA
#PB_color_springgreen            = $00FF7F
#PB_color_steelblue              = $4682B4
#PB_color_tan                    = $D2B48C
#PB_color_teal                   = $008080
#PB_color_thistle                = $D8BFD8
#PB_color_tomato                 = $FF6347
#PB_color_turquoise              = $40E0D0
#PB_color_violet                 = $EE82EE
#PB_color_wheat                  = $F5DEB3
#PB_color_white                  = $FFFFFF
#PB_color_whitesmoke             = $F5F5F5
#PB_color_yellow                 = $FFFF00
#PB_color_yellowgreen            = $9ACD32

;Gray colors
#PB_color_gray10 = $191919
#PB_color_gray20 = $323232
#PB_color_gray30 = $4b4b4b
#PB_color_gray40 = $656565
#PB_color_gray50 = $7f7f7f
#PB_color_gray60 = $989898
#PB_color_gray70 = $b1b1b1
#PB_color_gray80 = $cacaca
#PB_color_gray90 = $e4e4e4

and a crossplattform function for syscolors like:

Code: Select all

GetSysColor(#PB_syscolor_btnface)
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.
Image
Post Reply