PowerBuilder Colors
RGB
Deriving RGB values. The formula for combining primary color values into a number is:
256*256*blue + 256*green + red = number
where the amount of each primary color is specified as a value from 0 to 255. For example, to specify cyan, substitute 255 for blue, 255 for green, and 0 for red. The result is 16776960.
The table below lists the blue, green, and red values you can use in the formula to specify other colors.
Blue |
Green |
Red |
Number |
Color |
0 |
0 |
255 |
255 |
Red |
0 |
255 |
0 |
65280 |
Green |
0 |
128 |
255 |
32768 |
Dark Green |
255 |
0 |
0 |
16711680 |
Blue |
0 |
255 |
255 |
65535 |
Yellow |
0 |
128 |
128 |
328896 |
Brown |
255 |
255 |
0 |
16776960 |
Cyan |
192 |
192 |
192 |
12632256 |
Light gray |
255 |
255 |
192 |
|
Pale yellow |
100 |
100 |
100 |
|
Dark Gray |
System Colors
The current frameworks have a data color service to fetch the various system colors. To make use of this, call inv_datacolors.
long ll_selected_text IF NOT IsValid(gnv_cst_app_object.inv_datacolors) THEN gnv_cst_app_object.of_SetDataColors(True) END IF ll_selected_text = gnv_cst_app_object.inv_datacolors.of_SelectedColor() this.textcolor = ll_selected_text
The function calls are:
- gnv_cst_app_object.inv_datacolors.of_SelectedColor( ) // Selected background
- gnv_cst_app_object.inv_datacolors.of_EnterableColor( ) // window text
- gnv_cst_app_object.inv_datacolors.of_ReadOnlyColor( ) // buttonface
- gnv_cst_app_object.inv_datacolors.of_SelectedTextColor // Selected text color
You can also hard code an RGB like value for various system colors. These are handy for using in datawindow expressions. Sorry, no Selected or Selected Text colors that I am aware of.
67108864 |
ButtonFace |
1073741824 |
WindowBackground |
33554432 |
WindowText |
268435456 |
ApplicationWorkspace |
553648127 |
Transparent |
- 2^25 – Window Text
- 2^26 – buttonface
- 2^27 – scrollbar background
- 2^28 – app. workspace
- 2^29 – transparent
- 2^30 – Window Background
- 2^31 – unused
- 2^32 – unused
5 Comments »
Leave a comment
-
Archives
- August 2009 (2)
- May 2009 (1)
- March 2009 (1)
- January 2009 (2)
- December 2008 (1)
- November 2008 (2)
- September 2008 (1)
- August 2008 (1)
- July 2008 (24)
- June 2008 (22)
- May 2008 (69)
- April 2008 (25)
-
Categories
-
RSS
Entries RSS
Comments RSS
Addition to your description of the fourth byte in the color value:
2^24 (10000000h) + rgb(x, y, z) = One of the Custom colors, defined in the PB IDE
CUSTOM RGB(224, 224, 224): 31514848 = 1E0E0E0
CUSTOM RGB(240, 240, 240): 32567536 = 1F0F0F0
CUSTOM RGB(255, 255, 216): 30998527 = 1D8FFFF
2^27 (08000000h) + x = Other Standard Windows Color:
Scrollbar Background: 134217728 = 08 000000
Desktop Background: 134217729 = 08 000001
Active Title Bar: 134217730 = 08 000002
Inactive Title Bar: 134217731 = 08 000003
Menu Bar: 134217732 = 08 000004
Window Frame: 134217734 = 08 000006
Menu Text: 134217735 = 08 000007
Active Title Bar Text: 134217737 = 08 000009
Active Border: 134217738 = 08 00000A
Inactive Border: 134217739 = 08 00000B
Highlight: 134217741 = 08 00000D
Highlight Text: 134217742 = 08 00000E
Button Shadow: 134217744 = 08 000010
Disabled Text: 134217745 = 08 000011
Button Text: 134217746 = 08 000012
Inactive Title Bar Text: 134217747 = 08 000013
Button Highlight: 134217748 = 08 000014
Button Dark Shadow: 134217749 = 08 000015
Button Light Shadow: 134217750 = 08 000016
Tooltip Text: 134217751 = 08 000017
Tooltip: 134217752 = 08 000018
Link: 134217856 = 08 000080
Link Hover: 134217857 = 08 000081
Link Inactive: 134217858 = 08 000082
Link Visited: 134217859 = 08 000083
Comment by Ivaylo Ivanov | September 2, 2009 |
Much appreciated! I wish they’d made it easier to do the color – name link because without these notes, I wouldn’t have managed at all!!!
Comment by Robin | September 10, 2014 |
@Robin – an easy way to work out the code for a colour is to set a control to a given colour, and then edit source of the object and find that control in the source, which will then show the colour code for the colour the control is set to
Comment by Nathan | October 15, 2014 |
Reblogged this on :) and commented:
Y lo sigo usando
Comment by elchedavid | October 10, 2016 |
HELP!!! — I know I’m probably in the wrong place asking the wrong question, but I am DESPERATELY looking for a way to set the background color of a PowerBuilder HTrackBar. There seems to be no color properties available. Can this be true??? Any help would be much appreciated…
Thanks
Chuck
cpaci1@verizon.net
Comment by Chuck | December 1, 2017 |