Using System Colours - Forum - OpenEdge Development - Progress Community
 Forum

Using System Colours

  • I'm kind of getting bored with the standard 15 colours in the colour table.. and was wondering if there's any way to reference a system colour.

    For example, in Windows the 3D-Objects is a light greyish colour, unless you're using the XP theme and it's more of a yellow. Apart from using the three-d attribute, is there another way to use this, and other system colours? Eg Application Background, ToolTip, Selected Items.

  • &global-define COLOR_scrollbar 0

    &global-define COLOR_background 1

    &global-define COLOR_activeCaption 2

    &global-define COLOR_inactivecaption 3

    &global-define COLOR_menu 4

    &global-define COLOR_window 5

    &global-define COLOR_windowFrame 6

    &global-define COLOR_menuText 7

    &global-define COLOR_windowText 8

    &global-define COLOR_captionText 9

    &global-define COLOR_activeBorder 10

    &global-define COLOR_inactiveBorder 11

    &global-define COLOR_appWorkspace 12

    &global-define COLOR_highlight 13

    &global-define COLOR_highlightText 14

    &global-define COLOR_btnFace 15

    &global-define COLOR_btnShadow 16

    &global-define COLOR_grayText 17

    &global-define COLOR_btnText 18

    &global-define COLOR_inactiveCaptionText 19

    &global-define COLOR_btnHighlight 20

    /************************************* Vars *******************************************/

    define var vrgb as int no-undo.

    /************************************* Widgets ****************************************/

    /************************************* Frame ******************************************/

    /************************************* Triggers****************************************/

    /***************************************************************************************

    **

      • Trigger Widget:

    **

      • Description:

    **

    ****************************************************************************************/

    /************************************* Main *******************************************/

    run create in vIniFile.

    run main.

    cleanUp().

    procedure main:

    run GetSysColor IN hpApi (, output vrgb).

    color-table:set-dynamic(15,yes).

    color-table:set-rgb-value( 15, vrgb).

    run GetSysColor IN hpApi (, output vrgb).

    color-table:set-dynamic(7,yes).

    color-table:set-rgb-value( 7, vrgb).

    run GetSysColor IN hpApi (, output vrgb).

    color-table:set-dynamic(8,yes).

    color-table:set-rgb-value( 8, vrgb).

    run GetSysColor IN hpApi (, output vrgb).

    color-table:set-dynamic(0,yes).

    color-table:set-rgb-value( 0, vrgb).

    run newColour( , 128, 255, 255 ).

    run newColour( , 217, 255, 217 ).

    /*run GetSysColor IN hpApi (3, output vrgb).

    color-table:set-dynamic(,yes).

    color-table:set-rgb-value( , vrgb). */

    run newColour( , 122, 150, 223 ).

    /* run GetSysColor IN hpApi (13, output vrgb).

    color-table:set-dynamic(,yes).

    color-table:set-rgb-value( , vrgb). */

    run newColour( , 49, 106, 196 ).

    run newColour( , 214, 223, 245 ).

    /* run GetSysColor IN hpApi (27, output vrgb).

    color-table:set-dynamic(,yes).

    color-table:set-rgb-value( , vrgb). */

    run newColour( , 61, 149, 255 ).

    run newColour( , 0, 191, 255 ).

    run newColour( , 0, 206, 209 ).

    run newColour( , 0, 250, 154 ).

    run newColour( , 0, 255, 127 ).

    run newColour( , 32, 178, 170 ).

    run newColour( , 70, 130, 180 ).

    run newColour( , 100, 149, 237 ).

    run newColour( , 102, 205, 170 ).

    run newColour( , 127, 255, 212 ).

    run newColour( , 135, 206, 235 ).

    run newColour( , 147, 112, 219 ).

    run newColour( , 176, 196, 222 ).

    run newColour( , 188, 143, 143 ).

    run newColour( , 189, 183, 107 ).

    run newColour( , 205, 133, 63 ).

    run newColour( , 205, 92, 92 ).

    run newColour( , 210, 105, 30 ).

    run newColour( , 210, 180, 140 ).

    run newColour( , 218, 165, 32 ).

    run newColour( , 219, 112, 147 ).

    run newColour( , 221, 160, 221 ).

    run newColour( , 222, 184, 135 ).

    run newColour( , 230, 230, 250 ).

    run newColour( , 233, 150, 122 ).

    run newColour( , 238, 232, 170 ).

    run newColour( , 240, 255, 255 ).

    run newColour( , 250, 128, 114 ).

    run newColour( , 250, 235, 215 ).

    run newColour( , 250, 250, 210 ).

    run newColour( , 255, 160, 122 ).

    run newColour( , 255, 215, 0 ).

    run newColour( , 255, 218, 185 ).

    run newColour( , 255, 228, 225 ).

    run newColour( , 255, 255, 224 ).

    run newColour( , 238, 130, 238 ).

    run newColour( , 240, 230, 140 ).

    run newColour( , 250, 240, 230 ).

    run newColour( , 128, 128, 128 ).

    run newColour( , 192, 192, 192 ).

    run newColour( , 242, 242, 242 ).

    lockIniFile().

    put-key-value color all no-error.

    unlockIniFile().

    end.

    /*********************************************************************************

      • I N C L U D E

    **

      • File: include/colours.i

    **

      • Author: Chris Paulson

    **

      • Date: 13-Sep-96

    **

      • Description: Defines system colours (as words)

      • Called by:

    **

      • Calls:

    **

      • Mod history:

    **

      • PSM 27-Mar-2003

      • New colours.

    **

      • JMM 29/07/04

      • New colours

    **

      • PSM 24-Aug-04

      • Yellow mix up.

    **

    *********************************************************************************/

    /********************************************************************************

    **

      • Include parameters:-

    **

    *********************************************************************************/

    &if defined(colours-include) eq 0 &then

    &global-define colours-include

    &global-define black 0

    &global-define darkBlue 1

    &global-define darkGreen 2

    &global-define darkCyan 3

    &global-define darkRed 4

    &global-define darkPink 5

    &global-define darkYellow 6

    &global-define darkGrey 7

    &global-define lightGrey 8

    &global-define lightBlue 9

    &global-define lightGreen 10

    &global-define lightCyan 11

    &global-define lightRed 12

    &global-define lightPink 13

    &global-define Yellow 14

    &global-define white 15

    &global-define lightYellowPlus 16

    &global-define lightCyanPlus 17

    &global-define lightGreenPlus 18

    &global-define windowsBlue 19

    &global-define InactiveWindowsBlue 20

    &global-define LightInactiveWindowsBlue 21

    &global-define LightFrame 22

    &global-define FrameBackground 23

    &global-define DeepSkyBlue 24

    &global-define DarkTurquoise 25

    &global-define MediumSpringGreen 26

    &global-define SpringGreen 27

    &global-define LightSeaGreen 28

    &global-define SteelBlue 29

    &global-define CornFlowerBlue 30

    &global-define MediumAquamarine 31

    &global-define Aquamarine 32

    &global-define SkyBlue 33

    &global-define MediumPurple 34

    &global-define LightSteelBlue 35

    &global-define RosyBrown 36

    &global-define DarkKhaki 37

    &global-define Peru 38

    &global-define IndianRed 39

    &global-define Chocolate 40

    &global-define Tan 41

    &global-define GoldenRod 42

    &global-define PaleVioletRed 43

    &global-define Plum 44

    &global-define Burlywood 45

    &global-define Lavender 46

    &global-define DarkSalmon 47

    &global-define PaleGoldenRod 48

    &global-define Azure 49

    &global-define Salmon 50

    &global-define AntiqueWhite 51

    &global-define LightGoldenRod 52

    &global-define LightSalmon 53

    &global-define Gold 54

    &global-define PeachPuff 55

    &global-define MistyRose 56

    &global-define LightYellow 57

    &global-define Violet 58

    &global-define Khaki 59

    &global-define Linen 60

    &global-define Grey 61

    &global-define Silver 62

    &global-define veryLightGrey 63

    procedure NewColour:

    define input param pNum as int no-undo.

    define input param pRed as int no-undo.

    define input param pGreen as int no-undo.

    define input param pBlue as int no-undo.

    if pNum

    return.

    if color-table:num-entries <> 256 then

    color-table:num-entries = 256.

    color-table:set-dynamic(pNum, yes).

    color-table:set-rgb-value(pNum, rgb-value(pRed, pGreen, pBlue)).

    return.

    end.

    &endif

    /****************************** END INCLUDE *************************************/