combobox color

combobox color

Postby Silvio.Falconi » Tue Oct 14, 2014 9:20 am

It possibile to make a combobox with colors?

sample to select a list of color ( the strings are formated with background color )

as this


Image

it is possible in fwh ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6766
Joined: Thu Oct 18, 2012 7:17 pm

Re: combobox color

Postby ukoenig » Tue Oct 14, 2014 10:40 am

Silvio,

I couldn't find anything to fill the CELL of a combobox with a defined color.
Why not using a xBrowse, because the cell can have any size and it looks much better.
Have a look at the RGB-tool using a xBrowse as a colorpicker.

Image

The METRO-color-selector

Code: Select all  Expand view

FUNCTION RGB_METRO( oDlg )
LOCAL oBrw1, aDat1, i

aDat1:={{"","METRO_LIME", 50340 },;
                 {"","METRO_GREEN", 1550688 },;
                 {"","METRO_EMERALD", 35328 },;
                 {"","METRO_TEAL", 11119360 },;
                 {"","METRO_CYAN", 14852379 },;
                 {"","METRO_COBALT", 15683584 },;
                 {"","METRO_INDIGO", 16711786 },;
                 {"","METRO_VIOLET", 16711850 },;
                 {"","METRO_PINK", 13660916 },;
                 {"","METRO_MAGENTA", 7536856 },;
                 {"","METRO_CRIMSON", 2424994 },;
                 {"","METRO_RED", 5349 },;
                 {"","METRO_ORANGE", 26874 },;
                 {"","METRO_AMBER", 697328 },;
                 {"","METRO_YELLOW", 51427 },;
                 {"","METRO_BROWN", 2906754 },;
                 {"","METRO_OLIVE", 6588269 },;
                 {"","METRO_STEEL", 8877668 },;
                 {"","METRO_MAUVE", 9068662 },;
                 {"","METRO_TAUPE", 5142919 }}

REDEFINE XBROWSE oBrw1 ID 510 OF oDlg ARRAY aDat1 ;
FIELDS aDat1[ oBrw1:nArrayAt ][ 1 ], aDat1[ oBrw1:nArrayAt ][ 2 ] ;
LINES COLSIZES 30, 114 ;
HEADERS "Col", "          Value" FONT oFont1

WITH OBJECT oBrw1
   :lHScroll    := .F.
   :lVScroll    := .F.
   :nMarqueeStyle  := 1
   :nRowHeight := 29.5
   :SetGroupHeader( "   METRO", 1, 2 )
END

oBrw1:aCols[ 1 ]:bClrStd = { || { , aDat1[ oBrw1:KeyNo() ][ 3 ] } }

// Refresh defined images and text
// ---------------------------------------

oBrw1:bLClicked := { | nRow, nCol | ( nRPos := oBrw1:KeyNo(), ;
                           RGB_UPD2( oDlg, aDat1[ nRPos ][ 3 ], aDat1[ nRPos ][ 2 ] ) ) }

oBrw1:bChange := { | nRow, nCol | (  nRPos := oBrw1:KeyNo(), ;
                           RGB_UPD2( oDlg, aDat1[ nRPos ][ 3 ], aDat1[ nRPos ][ 2 ] ) ) }

// Color numeric-result
// ------------------------
REDEFINE GET oValRGB VAR nValRGB  ID 920 OF oDlg  PICTURE "9999999999" FONT oFont3 UPDATE

//RGB text-result
// ------------------
REDEFINE GET oTextRGB VAR cTextRGB  ID 940 OF oDlg   FONT oFont3 UPDATE

// Bmp-result
// -------------
REDEFINE BITMAP oResRGB FILENAME NIL OF oDlg ;
ID  900 PIXEL  ADJUST BORDER UPDATE
oResRGB:bPainted := { |hDC| DRAW_BMP( oResRGB, hDC, nResRGB ) }

RETURN NIL

//------------- BMP-Brush ( image-preview ) -----------

FUNCTION DRAW_BMP( oBitmap, hDC, nColor )
LOCAL oBMPBrush
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )

DEFINE BRUSH oBMPBrush COLOR nColor
FillRect( oBitmap:hDC, aRect, oBMPBrush:hBrush )
oBMPBrush:End()

RETURN( NIL )

// ------------- IMAGES - and COLOR-STRINGS -update ------

FUNCTION RGB_UPD2( oDlg, nColor, cColor )
LOCAL nBlue, nGreen, nRed

nRed := nRGBRed( nColor )
nGreen := nRGBGreen( nColor )
nBlue := nRGBBlue( nColor )

// Color-Image
// ---------------
nResRGB := nColor
oResRGB:Refresh()

// color-value ( numeric )
// ---------------------------
nValRGB := nColor
oValRGB:Refresh()

// RGB-color-string
// -------------------
cTextRGB := "nRGB( " + ALLTRIM(STR(nRed)) + ", " + ;
     ALLTRIM(STR(nGreen)) + ", " + ;
     ALLTRIM(STR(nBlue)) + " )"
oTextRGB:Refresh()

RETURN NIL
 


best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: combobox color

Postby Silvio.Falconi » Wed Oct 15, 2014 10:39 am

Uwe,
I made some modifies and I add others


Image





it can used as a Pick color!!

I insert mine Color set and Metro colors but we can insert other colors set !!

This is the source code ( no resources)


Code: Select all  Expand view



#include"fivewin.ch"
#include"xbrowse.ch"
#include "constant.ch"





static nResRGB ,OVALRGB,OTEXTRGB,cTextRGB

STATIC  aDat1

FUNCTION PickColor()
   Local oBrw1,  i
   Local nBottom   := 29
   Local nRight    := 66
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H

   Local oFont


 *  aDat1 :=  Select_colors_Type()

    DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -12

   DEFINE DIALOG oDlg        ;
   TITLE "Pick Color"   ;
   SIZE nWidth, nHeight  PIXEL


  @ 0,0 XBROWSE oBrw1 OF oDlg  ARRAY aDat1 ;
      FIELDS aDat1[ oBrw1:nArrayAt ][ 1 ], aDat1[ oBrw1:nArrayAt ][ 2 ] ;
      LINES COLSIZES 30, 114 ;
      HEADERS "Col", "          Value" FONT oFont ;
      SIZE 100,200 PIXEL


  @ 120,110 say "The color picked is:"  OF oDlg size 80,10 PIXEL  UPDATE
  @ 120,160 say oTextRgb PROMPT space(10)  OF oDlg size 80,10 PIXEL  UPDATE


WITH OBJECT oBrw1
   :lHScroll    := .F.
   :lVScroll    := .T.
   :nMarqueeStyle  := 1
   :nRowHeight := 20
   :SetGroupHeader( "   Colors", 1, 2 )
   :CreateFromCode()
END


oBrw1:aCols[ 1 ]:bClrStd = { || { , aDat1[ oBrw1:KeyNo() ][ 4 ] } }

oBrw1:bLClicked := { | nRow, nCol | ( nRPos := oBrw1:KeyNo(), ;
                           RGB_UPD2( oDlg, aDat1[ nRPos ][ 4 ], aDat1[ nRPos ][ 2 ],oTextRGB ) ) }

oBrw1:bChange := { | nRow, nCol | (  nRPos := oBrw1:KeyNo(), ;
                           RGB_UPD2( oDlg, aDat1[ nRPos ][ 4 ], aDat1[ nRPos ][ 2 ] ,oTextRGB) ) }


@ 2,100   BITMAP oResRGB FILENAME NIL OF oDlg PIXEL  size 160,100 ADJUST BORDER UPDATE
oResRGB:bPainted := { |hDC| DRAW_BMP( oResRGB, hDC, nResRGB ) }
@ 210, 5 say " Created by Uwe ukoenig and modify by Falconi Silvio " OF oDlg size 200,10  PIXEL
@ 190, 110 BUTTON "Select Colors Type" OF oDlg size 60,10  PIXEL action NewColor(oBrw1)
@ 190, 175 BUTTON "Pick Color" OF oDlg size 40,10  PIXEL ACTION  ( oDlg:end( IDOK ) )
@ 190, 235 BUTTON "Exit" OF oDlg size 20,10  PIXEL ACTION  ( oDlg:end( IDCANCEL ) )

ACTIVATE DIALOG oDlg center

IF oDlg:nresult == IDOK
   return  aDat1[ nRPos ][ 4 ]
Endif
   // ?   aDat1[ oBrw1:KeyNo() ][ 4 ]

RETURN NIL


Function NewColor(oBrw1)
   aDat1:=Select_Colors_Type()
   oBrw1:setarray(aDat1)
   oBrw1:refresh()

RETURN NIL


//------------- BMP-Brush ( image-preview ) -----------

FUNCTION DRAW_BMP( oBitmap, hDC, nColor )
LOCAL oBMPBrush
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )

DEFINE BRUSH oBMPBrush COLOR nColor
FillRect( oBitmap:hDC, aRect, oBMPBrush:hBrush )
oBMPBrush:End()

RETURN( NIL )

// ------------- IMAGES - and COLOR-STRINGS -update ------

FUNCTION RGB_UPD2( oDlg, nColor, cColor,oTextRGB )
LOCAL nBlue, nGreen, nRed

nRed := nRGBRed( nColor )
nGreen := nRGBGreen( nColor )
nBlue := nRGBBlue( nColor )

// Color-Image
// ---------------
nResRGB := nColor
oResRGB:Refresh()

// color-value ( numeric )
// ---------------------------
nValRGB := nColor
*oValRGB:Refresh()

// RGB-color-string
// -------------------
cTextRGB := "nRGB( " + ALLTRIM(STR(nRed)) + ", " + ;
     ALLTRIM(STR(nGreen)) + ", " + ;
     ALLTRIM(STR(nBlue)) + " )"

           oTextRGB:SetText(cTextRGB)

RETURN NIL





 Function InitColorsArray()

 aColors := { ;
 {"Snow", "255 250 250"} ,;
 {"GhostWhite", "248 248 255"} ,;
 {"WhiteSmoke", "245 245 245"} ,;
 {"Gainsboro", "220 220 220"} ,;
 {"FloralWhite", "255 250 240"} ,;
 {"OldLace", "253 245 230"} ,;
 {"Linen", "250 240 230"} ,;
 {"AntiqueWhite", "250 235 215"} ,;
 {"PapayaWhip", "255 239 213"} ,;
 {"BlanchedAlmond", "255 235 205"} ,;
 {"Bisque", "255 228 196"} ,;
 {"PeachPuff", "255 218 185"} ,;
 {"NavajoWhite", "255 222 173"} ,;
 {"Moccasin", "255 228 181"} ,;
 {"Cornsilk", "255 248 220"} ,;
 {"Ivory", "255 255 240"} ,;
 {"LemonChiffon", "255 250 205"} ,;
 {"Seashell", "255 245 238"} ,;
 {"Honeydew", "240 255 240"} ,;
 {"MintCream", "245 255 250"} ,;
 {"Azure", "240 255 255"} ,;
 {"AliceBlue", "240 248 255"} ,;
 {"Lavender", "230 230 250"} ,;
 {"LavenderBlush", "255 240 245"} ,;
 {"MistyRose", "255 228 225"} ,;
 {"White", "255 255 255"} ,;
 {"Black", "0 0 0"} ,;
 {"DarkSlateGray", "47 79 79"} ,;
 {"DimGrey", "105 105 105"} ,;
 {"SlateGrey", "112 128 144"} ,;
 {"LightSlateGray", "119 136 153"} ,;
 {"Grey", "190 190 190"} ,;
 {"LightGray", "211 211 211"} ,;
 {"MidnightBlue", "25 25 112"} ,;
 {"NavyBlue (Navy)", "0 0 128"} ,;
 {"CornflowerBlue", "100 149 237"} ,;
 {"DarkSlateBlue", "72 61 139"} ,;
 {"SlateBlue", "106 90 205"} ,;
 {"MediumSlateBlue", "123 104 238"} ,;
 {"LightSlateBlue", "132 112 255"} ,;
 {"MediumBlue", "0 0 205"} ,;
 {"RoyalBlue", "65 105 225"} ,;
 {"Blue", "0 0 255"} ,;
 {"DodgerBlue", "30 144 255"} ,;
 {"DeepSkyBlue", "0 191 255"} ,;
 {"SkyBlue", "135 206 235"} ,;
 {"LightSkyBlue", "135 206 250"} ,;
 {"SteelBlue", "70 130 180"} ,;
 {"LightSteelBlue", "176 196 222"} ,;
 {"LightBlue", "173 216 230"} ,;
 {"PowderBlue", "176 224 230"} ,;
 {"PaleTurquoise", "175 238 238"} ,;
 {"DarkTurquoise", "0 206 209"} ,;
 {"MediumTurquoise", "72 209 204"} ,;
 {"Turquoise", "64 224 208"} ,;
 {"Cyan", "0 255 255"} ,;
 {"LightCyan", "224 255 255"} ,;
 {"CadetBlue", "95 158 160"} ,;
 {"MediumAquamarine", "102 205 170"} ,;
 {"Aquamarine", "127 255 212"} ,;
 {"DarkGreen", "0 100 0"} ,;
 {"DarkOliveGreen", "85 107 47"} ,;
 {"DarkSeaGreen", "143 188 143"} ,;
 {"SeaGreen", "46 139 87"} ,;
 {"MediumSeaGreen", "60 179 113"} ,;
 {"LightSeaGreen", "32 178 170"} ,;
 {"PaleGreen", "152 251 152"} ,;
 {"SpringGreen", "0 255 127"} ,;
 {"LawnGreen", "124 252 0"} ,;
 {"Green", "0 255 0"} ,;
 {"Chartreuse", "127 255 0"} ,;
 {"MediumSpringGreen", "0 250 154"} ,;
 {"GreenYellow", "173 255 47"} ,;
 {"LimeGreen", "50 205 50"} ,;
 {"YellowGreen", "154 205 50"} ,;
 {"ForestGreen", "34 139 34"} ,;
 {"OliveDrab", "107 142 35"} ,;
 {"DarkKhaki", "189 183 107"} ,;
 {"Khaki", "240 230 140"} ,;
 {"PaleGoldenrod", "238 232 170"} ,;
 {"LightGoldenrodYellow", "250 250 210"} ,;
 {"LightYellow", "255 255 224"} ,;
 {"Yellow", "255 255 0"} ,;
 {"Gold", "255 215 0"} ,;
 {"LightGoldenrod", "238 221 130"} ,;
 {"Goldenrod", "218 165 32"} ,;
 {"DarkGoldenrod", "184 134 11"} ,;
 {"RosyBrown", "188 143 143"} ,;
 {"IndianRed", "205 92 92"} ,;
 {"SaddleBrown", "139 69 19"} ,;
 {"Sienna", "160 82 45"} ,;
 {"Peru", "205 133 63"} ,;
 {"Burlywood", "222 184 135"} ,;
 {"Beige", "245 245 220"} ,;
 {"Wheat", "245 222 179"} ,;
 {"SandyBrown", "244 164 96"} ,;
 {"Tan", "210 180 140"} ,;
 {"Chocolate", "210 105 30"} ,;
 {"Firebrick", "178 34 34"} ,;
 {"Brown", "165 42 42"} ,;
 {"DarkSalmon", "233 150 122"} ,;
 {"Salmon", "250 128 114"} ,;
 {"LightSalmon", "255 160 122"} ,;
 {"Orange", "255 165 0"} ,;
 {"DarkOrange", "255 140 0"} ,;
 {"Coral", "255 127 80"} ,;
 {"LightCoral", "240 128 128"} ,;
 {"Tomato", "255 99 71"} ,;
 {"OrangeRed", "255 69 0"} ,;
 {"Red", "255 0 0"} ,;
 {"HotPink", "255 105 180"} ,;
 {"DeepPink", "255 20 147"} ,;
 {"Pink", "255 192 203"} ,;
 {"LightPink", "255 182 193"} ,;
 {"PaleVioletRed", "219 112 147"} ,;
 {"Maroon", "176 48 96"} ,;
 {"MediumVioletRed", "199 21 133"} ,;
 {"VioletRed", "208 32 144"} ,;
 {"Magenta", "255 0 255"} ,;
 {"Violet", "238 130 238"} ,;
 {"Plum", "221 160 221"} ,;
 {"Orchid", "218 112 214"} ,;
 {"MediumOrchid", "186 85 211"} ,;
 {"DarkOrchid", "153 50 204"} ,;
 {"BlueViolet", "138 43 226"} ,;
 {"Purple", "160 32 240"} ,;
 {"MediumPurple", "147 112 219"} ,;
 {"Thistle", "216 191 216"} ,;
 {"Snow1", "255 250 250"} ,;
 {"Snow2", "238 233 233"} ,;
 {"Snow3", "205 201 201"} ,;
 {"Snow4", "139 137 137"} ,;
 {"Seashell1", "255 245 238"} ,;
 {"Seashell2", "238 229 222"} ,;
 {"Seashell3", "205 197 191"} ,;
 {"Seashell4", "139 134 130"} ,;
 {"AntiqueWhite1", "255 239 219"} ,;
 {"AntiqueWhite2", "238 223 204"} ,;
 {"AntiqueWhite3", "205 192 176"} ,;
 {"AntiqueWhite4", "139 131 120"} ,;
 {"Bisque1", "255 228 196"} ,;
 {"Bisque2", "238 213 183"} ,;
 {"Bisque3", "205 183 158"} ,;
 {"Bisque4", "139 125 107"} ,;
 {"PeachPuff1", "255 218 185"} ,;
 {"PeachPuff2", "238 203 173"} ,;
 {"PeachPuff3", "205 175 149"} ,;
 {"PeachPuff4", "139 119 101"} ,;
 {"NavajoWhite1", "255 222 173"} ,;
 {"NavajoWhite2", "238 207 161"} ,;
 {"NavajoWhite3", "205 179 139"} ,;
 {"NavajoWhite4", "139 121 94"} ,;
 {"LemonChiffon1", "255 250 205"} ,;
 {"LemonChiffon2", "238 233 191"} ,;
 {"LemonChiffon3", "205 201 165"} ,;
 {"LemonChiffon4", "139 137 112"} ,;
 {"Cornsilk1", "255 248 220"} ,;
 {"Cornsilk2", "238 232 205"} ,;
 {"Cornsilk3", "205 200 177"} ,;
 {"Cornsilk4", "139 136 120"} ,;
 {"Ivory1", "255 255 240"} ,;
 {"Ivory2", "238 238 224"} ,;
 {"Ivory3", "205 205 193"} ,;
 {"Ivory4", "139 139 131"} ,;
 {"Honeydew1", "240 255 240"} ,;
 {"Honeydew2", "224 238 224"} ,;
 {"Honeydew3", "193 205 193"} ,;
 {"Honeydew4", "131 139 131"} ,;
 {"LavenderBlush1", "255 240 245"} ,;
 {"LavenderBlush2", "238 224 229"} ,;
 {"LavenderBlush3", "205 193 197"} ,;
 {"LavenderBlush4", "139 131 134"} ,;
 {"MistyRose1", "255 228 225"} ,;
 {"MistyRose2", "238 213 210"} ,;
 {"MistyRose3", "205 183 181"} ,;
 {"MistyRose4", "139 125 123"} ,;
 {"Azure1", "240 255 255"} ,;
 {"Azure2", "224 238 238"} ,;
 {"Azure3", "193 205 205"} ,;
 {"Azure4", "131 139 139"} ,;
 {"SlateBlue1", "131 111 255"} ,;
 {"SlateBlue2", "122 103 238"} ,;
 {"SlateBlue3", "105 89 205"} ,;
 {"SlateBlue4", "71 60 139"} ,;
 {"RoyalBlue1", "72 118 255"} ,;
 {"RoyalBlue2", "67 110 238"} ,;
 {"RoyalBlue3", "58 95 205"} ,;
 {"RoyalBlue4", "39 64 139"} ,;
 {"Blue1", "0 0 255"} ,;
 {"Blue2", "0 0 238"} ,;
 {"Blue3", "0 0 205"} ,;
 {"Blue4", "0 0 139"} ,;
 {"DodgerBlue1", "30 144 255"} ,;
 {"DodgerBlue2", "28 134 238"} ,;
 {"DodgerBlue3", "24 116 205"} ,;
 {"DodgerBlue4", "16 78 139"} ,;
 {"SteelBlue1", "99 184 255"} ,;
 {"SteelBlue2", "92 172 238"} ,;
 {"SteelBlue3", "79 148 205"} ,;
 {"SteelBlue4", "54 100 139"} ,;
 {"DeepSkyBlue1", "0 191 255"} ,;
 {"DeepSkyBlue2", "0 178 238"} ,;
 {"DeepSkyBlue3", "0 154 205"} ,;
 {"DeepSkyBlue4", "0 104 139"} ,;
 {"SkyBlue1", "135 206 255"} ,;
 {"SkyBlue2", "126 192 238"} ,;
 {"SkyBlue3", "108 166 205"} ,;
 {"SkyBlue4", "74 112 139"} ,;
 {"LightSkyBlue1", "176 226 255"} ,;
 {"LightSkyBlue2", "164 211 238"} ,;
 {"LightSkyBlue3", "141 182 205"} ,;
 {"LightSkyBlue4", "96 123 139"} ,;
 {"SlateGray1", "198 226 255"} ,;
 {"SlateGray2", "185 211 238"} ,;
 {"SlateGray3", "159 182 205"} ,;
 {"SlateGray4", "108 123 139"} ,;
 {"LightSteelBlue1", "202 225 255"} ,;
 {"LightSteelBlue2", "188 210 238"} ,;
 {"LightSteelBlue3", "162 181 205"} ,;
 {"LightSteelBlue4", "110 123 139"} ,;
 {"LightBlue1", "191 239 255"} ,;
 {"LightBlue2", "178 223 238"} ,;
 {"LightBlue3", "154 192 205"} ,;
 {"LightBlue4", "104 131 139"} ,;
 {"LightCyan1", "224 255 255"} ,;
 {"LightCyan2", "209 238 238"} ,;
 {"LightCyan3", "180 205 205"} ,;
 {"LightCyan4", "122 139 139"} ,;
 {"PaleTurquoise1", "187 255 255"} ,;
 {"PaleTurquoise2", "174 238 238"} ,;
 {"PaleTurquoise3", "150 205 205"} ,;
 {"PaleTurquoise4", "102 139 139"} ,;
 {"CadetBlue1", "152 245 255"} ,;
 {"CadetBlue2", "142 229 238"} ,;
 {"CadetBlue3", "122 197 205"} ,;
 {"CadetBlue4", "83 134 139"} ,;
 {"Turquoise1", "0 245 255"} ,;
 {"Turquoise2", "0 229 238"} ,;
 {"Turquoise3", "0 197 205"} ,;
 {"Turquoise4", "0 134 139"} ,;
 {"Cyan1", "0 255 255"} ,;
 {"Cyan2", "0 238 238"} ,;
 {"Cyan3", "0 205 205"} ,;
 {"Cyan4", "0 139 139"} ,;
 {"DarkSlateGray1", "151 255 255"} ,;
 {"DarkSlateGray2", "141 238 238"} ,;
 {"DarkSlateGray3", "121 205 205"} ,;
 {"DarkSlateGray4", "82 139 139"} ,;
 {"Aquamarine1", "127 255 212"} ,;
 {"Aquamarine2", "118 238 198"} ,;
 {"Aquamarine3", "102 205 170"} ,;
 {"Aquamarine4", "69 139 116"} ,;
 {"DarkSeaGreen1", "193 255 193"} ,;
 {"DarkSeaGreen2", "180 238 180"} ,;
 {"DarkSeaGreen3", "155 205 155"} ,;
 {"DarkSeaGreen4", "105 139 105"} ,;
 {"SeaGreen1", "84 255 159"} ,;
 {"SeaGreen2", "78 238 148"} ,;
 {"SeaGreen3", "67 205 128"} ,;
 {"SeaGreen4", "46 139 87"} ,;
 {"PaleGreen1", "154 255 154"} ,;
 {"PaleGreen2", "144 238 144"} ,;
 {"PaleGreen3", "124 205 124"} ,;
 {"PaleGreen4", "84 139 84"} ,;
 {"SpringGreen1", "0 255 127"} ,;
 {"SpringGreen2", "0 238 118"} ,;
 {"SpringGreen3", "0 205 102"} ,;
 {"SpringGreen4", "0 139 69"} ,;
 {"Green1", "0 255 0"} ,;
 {"Green2", "0 238 0"} ,;
 {"Green3", "0 205 0"} ,;
 {"Green4", "0 139 0"} ,;
 {"Chartreuse1", "127 255 0"} ,;
 {"Chartreuse2", "118 238 0"} ,;
 {"Chartreuse3", "102 205 0"} ,;
 {"Chartreuse4", "69 139 0"} ,;
 {"OliveDrab1", "192 255 62"} ,;
 {"OliveDrab2", "179 238 58"} ,;
 {"OliveDrab3", "154 205 50"} ,;
 {"OliveDrab4", "105 139 34"} ,;
 {"DarkOliveGreen1", "202 255 112"} ,;
 {"DarkOliveGreen2", "188 238 104"} ,;
 {"DarkOliveGreen3", "162 205 90"} ,;
 {"DarkOliveGreen4", "110 139 61"} ,;
 {"Khaki1", "255 246 143"} ,;
 {"Khaki2", "238 230 133"} ,;
 {"Khaki3", "205 198 115"} ,;
 {"Khaki4", "139 134 78"} ,;
 {"LightGoldenrod1", "255 236 139"} ,;
 {"LightGoldenrod2", "238 220 130"} ,;
 {"LightGoldenrod3", "205 190 112"} ,;
 {"LightGoldenrod4", "139 129 76"} ,;
 {"LightYellow1", "255 255 224"} ,;
 {"LightYellow2", "238 238 209"} ,;
 {"LightYellow3", "205 205 180"} ,;
 {"LightYellow4", "139 139 122"} ,;
 {"Yellow1", "255 255 0"} ,;
 {"Yellow2", "238 238 0"} ,;
 {"Yellow3", "205 205 0"} ,;
 {"Yellow4", "139 139 0"} ,;
 {"Gold1", "255 215 0"} ,;
 {"Gold2", "238 201 0"} ,;
 {"Gold3", "205 173 0"} ,;
 {"Gold4", "139 117 0"} ,;
 {"Goldenrod1", "255 193 37"} ,;
 {"Goldenrod2", "238 180 34"} ,;
 {"Goldenrod3", "205 155 29"} ,;
 {"Goldenrod4", "139 105 20"} ,;
 {"DarkGoldenrod1", "255 185 15"} ,;
 {"DarkGoldenrod2", "238 173 14"} ,;
 {"DarkGoldenrod3", "205 149 12"} ,;
 {"DarkGoldenrod4", "139 101 8"} ,;
 {"RosyBrown1", "255 193 193"} ,;
 {"RosyBrown2", "238 180 180"} ,;
 {"RosyBrown3", "205 155 155"} ,;
 {"RosyBrown4", "139 105 105"} ,;
 {"IndianRed1", "255 106 106"} ,;
 {"IndianRed2", "238 99 99"} ,;
 {"IndianRed3", "205 85 85"} ,;
 {"IndianRed4", "139 58 58"} ,;
 {"Sienna1", "255 130 71"} ,;
 {"Sienna2", "238 121 66"} ,;
 {"Sienna3", "205 104 57"} ,;
 {"Sienna4", "139 71 38"} ,;
 {"Burlywood1", "255 211 155"} ,;
 {"Burlywood2", "238 197 145"} ,;
 {"Burlywood3", "205 170 125"} ,;
 {"Burlywood4", "139 115 85"} ,;
 {"Wheat1", "255 231 186"} ,;
 {"Wheat2", "238 216 174"} ,;
 {"Wheat3", "205 186 150"} ,;
 {"Wheat4", "139 126 102"} ,;
 {"Tan1", "255 165 79"} ,;
 {"Tan2", "238 154 73"} ,;
 {"Tan3", "205 133 63"} ,;
 {"Tan4", "139 90 43"} ,;
 {"Chocolate1", "255 127 36"} ,;
 {"Chocolate2", "238 118 33"} ,;
 {"Chocolate3", "205 102 29"} ,;
 {"Chocolate4", "139 69 19"} ,;
 {"Firebrick1", "255 48 48"} ,;
 {"Firebrick2", "238 44 44"} ,;
 {"Firebrick3", "205 38 38"} ,;
 {"Firebrick4", "139 26 26"} ,;
 {"Brown1", "255 64 64"} ,;
 {"Brown2", "238 59 59"} ,;
 {"Brown3", "205 51 51"} ,;
 {"Brown4", "139 35 35"} ,;
 {"Salmon1", "255 140 105"} ,;
 {"Salmon2", "238 130 98"} ,;
 {"Salmon3", "205 112 84"} ,;
 {"Salmon4", "139 76 57"} ,;
 {"LightSalmon1", "255 160 122"} ,;
 {"LightSalmon2", "238 149 114"} ,;
 {"LightSalmon3", "205 129 98"} ,;
 {"LightSalmon4", "139 87 66"} ,;
 {"Orange1", "255 165 0"} ,;
 {"Orange2", "238 154 0"} ,;
 {"Orange3", "205 133 0"} ,;
 {"Orange4", "139 90 0"} ,;
 {"DarkOrange1", "255 127 0"} ,;
 {"DarkOrange2", "238 118 0"} ,;
 {"DarkOrange3", "205 102 0"} ,;
 {"DarkOrange4", "139 69 0"} ,;
 {"Coral1", "255 114 86"} ,;
 {"Coral2", "238 106 80"} ,;
 {"Coral3", "205 91 69"} ,;
 {"Coral4", "139 62 47"} ,;
 {"Tomato1", "255 99 71"} ,;
 {"Tomato2", "238 92 66"} ,;
 {"Tomato3", "205 79 57"} ,;
 {"Tomato4", "139 54 38"} ,;
 {"OrangeRed1", "255 69 0"} ,;
 {"OrangeRed2", "238 64 0"} ,;
 {"OrangeRed3", "205 55 0"} ,;
 {"OrangeRed4", "139 37 0"} ,;
 {"Red1", "255 0 0"} ,;
 {"Red2", "238 0 0"} ,;
 {"Red3", "205 0 0"} ,;
 {"Red4", "139 0 0"} ,;
 {"DeepPink1", "255 20 147"} ,;
 {"DeepPink2", "238 18 137"} ,;
 {"DeepPink3", "205 16 118"} ,;
 {"DeepPink4", "139 10 80"} ,;
 {"HotPink1", "255 110 180"} ,;
 {"HotPink2", "238 106 167"} ,;
 {"HotPink3", "205 96 144"} ,;
 {"HotPink4", "139 58 98"} ,;
 {"Pink1", "255 181 197"} ,;
 {"Pink2", "238 169 184"} ,;
 {"Pink3", "205 145 158"} ,;
 {"Pink4", "139 99 108"} ,;
 {"LightPink1", "255 174 185"} ,;
 {"LightPink2", "238 162 173"} ,;
 {"LightPink3", "205 140 149"} ,;
 {"LightPink4", "139 95 101"} ,;
 {"PaleVioletRed1", "255 130 171"} ,;
 {"PaleVioletRed2", "238 121 159"} ,;
 {"PaleVioletRed3", "205 104 137"} ,;
 {"PaleVioletRed4", "139 71 93"} ,;
 {"Maroon1", "255 52 179"} ,;
 {"Maroon2", "238 48 167"} ,;
 {"Maroon3", "205 41 144"} ,;
 {"Maroon4", "139 28 98"} ,;
 {"VioletRed1", "255 62 150"} ,;
 {"VioletRed2", "238 58 140"} ,;
 {"VioletRed3", "205 50 120"} ,;
 {"VioletRed4", "139 34 82"} ,;
 {"Magenta1", "255 0 255"} ,;
 {"Magenta2", "238 0 238"} ,;
 {"Magenta3", "205 0 205"} ,;
 {"Magenta4", "139 0 139"} ,;
 {"Orchid1", "255 131 250"} ,;
 {"Orchid2", "238 122 233"} ,;
 {"Orchid3", "205 105 201"} ,;
 {"Orchid4", "139 71 137"} ,;
 {"Plum1", "255 187 255"} ,;
 {"Plum2", "238 174 238"} ,;
 {"Plum3", "205 150 205"} ,;
 {"Plum4", "139 102 139"} ,;
 {"MediumOrchid1", "224 102 255"} ,;
 {"MediumOrchid2", "209 95 238"} ,;
 {"MediumOrchid3", "180 82 205"} ,;
 {"MediumOrchid4", "122 55 139"} ,;
 {"DarkOrchid1", "191 62 255"} ,;
 {"DarkOrchid2", "178 58 238"} ,;
 {"DarkOrchid3", "154 50 205"} ,;
 {"DarkOrchid4", "104 34 139"} ,;
 {"Purple1", "155 48 255"} ,;
 {"Purple2", "145 44 238"} ,;
 {"Purple3", "125 38 205"} ,;
 {"Purple4", "85 26 139"} ,;
 {"MediumPurple1", "171 130 255"} ,;
 {"MediumPurple2", "159 121 238"} ,;
 {"MediumPurple3", "137 104 205"} ,;
 {"MediumPurple4", "93 71 139"} ,;
 {"Thistle1", "255 225 255"} ,;
 {"Thistle2", "238 210 238"} ,;
 {"Thistle3", "205 181 205"} ,;
 {"Thistle4", "139 123 139"} ,;
 {"grey11", "28 28 28"} ,;
 {"grey21", "54 54 54"} ,;
 {"grey31", "79 79 79"} ,;
 {"grey41", "105 105 105"} ,;
 {"grey51", "130 130 130"} ,;
 {"grey61", "156 156 156"} ,;
 {"grey71", "181 181 181"} ,;
 {"grey81", "207 207 207"} ,;
 {"grey91", "232 232 232"} ,;
 {"DarkGrey", "169 169 169"} ,;
 {"DarkBlue", "0 0 139"} ,;
 {"DarkCyan", "0 139 139"} ,;
 {"DarkMagenta", "139 0 139"} ,;
 {"DarkRed", "139 0 0"} ,;
 {"LightGreen", "144 238 144"} }

Return aColors



   Function GetBackNumColor( aColors,n )
       Local nR, nG, nB
       cColor := aColors[n][ 2 ]
       nR := Val( Token( cColor, " ", 1 ) )
       nG := Val( Token( cColor, " ", 2 ) )
       nB := Val( Token( cColor, " ", 3 ) )
    return    (nR + ( nG * 256 ) + ( nB * 65536 ))




     Function GetBackColor( aColors,n )
       Local nR, nG, nB
       cColor := aColors[n][ 2 ]
       nR := Val( Token( cColor, " ", 1 ) )
       nG := Val( Token( cColor, " ", 2 ) )
       nB := Val( Token( cColor, " ", 3 ) )
       nColor:= 'RBG('+str(nR)+','+str(nG)+','+ str(nB)+')'
       return  nColor




 Function InitColorsArray_Metro()
    aColors := { ;
       {"METRO_LIME    ", "164 196   0"} ,;
       {"METRO_GREEN   ", "96  169  23"} ,;
       {"METRO_EMERALD ", "0   138   0"} ,;
       {"METRO_TEAL    ", "0   171 169"} ,;
       {"METRO_CYAN    ", "27  161 226"} ,;
       {"METRO_COBALT  ", "0    80 239"} ,;
       {"METRO_INDIGO  ", "106   0 255"} ,;
       {"METRO_VIOLET  ", "170   0 255"} ,;
       {"METRO_PINK    ", "244 114 208"} ,;
       {"METRO_MAGENTA ", "216   0 115"} ,;
       {"METRO_CRIMSON ", "162   0  37"} ,;
       {"METRO_RED     ", "229  20   0"} ,;
       {"METRO_ORANGE  ", "250 104   0"} ,;
       {"METRO_AMBER   ", "240 163  10"} ,;
       {"METRO_YELLOW  ", "227 200   0"} ,;
       {"METRO_BROWN   ", "130  90  44"} ,;
       {"METRO_OLIVE   ", "109 135 100"} ,;
       {"METRO_STEEL   ", "100 118 135"} ,;
       {"METRO_MAUVE   ", "118  96 138"} ,;
       {"METRO_TAUPE   ", "135 121  78"} }

Return aColors







      Function Select_Colors_Type(oBrw)
        Local oDlgSelect
        Local aColors := {}
        Local nBottom   := 12
        Local nRight    := 44
        Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
        Local nHeight := nBottom * DLG_CHARPIX_H
        Local ncolor:= 0
        Local aTempDat := {}


        DEFINE DIALOG oDlgSelect        ;
        TITLE "Select color type"   ;
        SIZE nWidth, nHeight  PIXEL

        @ 1,1 BUTTON "Metro colors" SIZE 60,10 OF oDlgSelect PIXEL  ACTION  ( nColor:=1, oDlgSelect:end( IDOK ) )
        @ 15,1 BUTTON "Windows colors" SIZE 60,10 OF oDlgSelect PIXEL  ACTION  ( nColor:=2, oDlgSelect:end( IDOK ) )

        ACTIVATE DIALOG oDlgSelect center

          IF oDlgSelect:nresult == IDOK
             DO CASE
                CASE  nColor = 1
                   aColors:= InitColorsArray_Metro()
                CASE ncolor = 2
                   aColors:=  InitColorsArray()
              ENDCASE


        For n= 1 to Len( aColors )
          AaDd( aTempDat,{"",aColors[n][1], GetBackColor(aColors,n), GetBackNumColor(aColors,n)  } )
        next

     ENDIF

     adel(aColors)
     asort( aTempDat)



       return aTempDat







 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6766
Joined: Thu Oct 18, 2012 7:17 pm

Re: combobox color

Postby Silvio.Falconi » Wed Oct 15, 2014 11:04 am

other changes

Image

we can use it on a get action bitmap

sample :

@ 26, 186 GET aGet[3] VAR cminecolor OF oDlg SIZE 52, 12 PIXEL FONT oFont ;
BITMAP "SH_colors" ACTION PickColor()



Code: Select all  Expand view

#include"fivewin.ch"
#include"xbrowse.ch"
#include "constant.ch"

static nResRGB ,OVALRGB,OTEXTRGB,cTextRGB

STATIC  aDat1

Function Main()

   nColor:= PickColor()

   ?ncolor

   RETUR NIL




FUNCTION PickColor()
   Local oBrw1,  i
   Local nBottom   := 14
   Local nRight    := 38
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
   Local oFont

    DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -12

   DEFINE DIALOG oDlg        ;
   TITLE "Pick Color"   ;
   SIZE nWidth, nHeight  PIXEL


  @ 0,0 XBROWSE oBrw1 OF oDlg  ARRAY aDat1 ;
      FIELDS aDat1[ oBrw1:nArrayAt ][ 1 ], aDat1[ oBrw1:nArrayAt ][ 2 ] ;
      LINES COLSIZES 30, 114 ;
      HEADERS "Col", "          Value" FONT oFont ;
      SIZE 100,60 PIXEL


  @ 120,110 say "The color picked is:"  OF oDlg size 80,10 PIXEL  UPDATE
  @ 120,160 say oTextRgb PROMPT space(10)  OF oDlg size 80,10 PIXEL  UPDATE


WITH OBJECT oBrw1
   :lHScroll    := .F.
   :lVScroll    := .T.
   :nMarqueeStyle  := 1
   :nRowHeight := 20
   :SetGroupHeader( "   Colors", 1, 2 )
   :CreateFromCode()
END


oBrw1:aCols[ 1 ]:bClrStd = { || { , aDat1[ oBrw1:KeyNo() ][ 4 ] } }

oBrw1:bLClicked := { | nRow, nCol | ( nRPos := oBrw1:KeyNo(), ;
                           RGB_UPD2( oDlg, aDat1[ nRPos ][ 4 ], aDat1[ nRPos ][ 2 ],oTextRGB ) ) }

oBrw1:bChange := { | nRow, nCol | (  nRPos := oBrw1:KeyNo(), ;
                           RGB_UPD2( oDlg, aDat1[ nRPos ][ 4 ], aDat1[ nRPos ][ 2 ] ,oTextRGB) ) }


@ 2,100   BITMAP oResRGB FILENAME NIL OF oDlg PIXEL  size 50,60 ADJUST BORDER UPDATE
oResRGB:bPainted := { |hDC| DRAW_BMP( oResRGB, hDC, nResRGB ) }
@ 65, 5 say " Created by Uwe ukoenig "+CRLF+"and modify by Falconi Silvio " OF oDlg size 200,20  PIXEL
@ 65, 100 BUTTON "Select Colors" OF oDlg size 40,10  PIXEL action NewColor(oBrw1)
@ 88, 57 BUTTON "Pick Color" OF oDlg size 40,10  PIXEL ACTION  ( oDlg:end( IDOK ) )
@ 88, 108 BUTTON "Exit" OF oDlg size 40,10  PIXEL ACTION  ( oDlg:end( IDCANCEL ) )

ACTIVATE DIALOG oDlg center;
on Init  NewColor(oBrw1)

IF oDlg:nresult == IDOK
   return  aDat1[oBrw1:KeyNo() ][ 4 ]
Endif
   // ?   aDat1[ oBrw1:KeyNo() ][ 4 ]

RETURN NIL


Function NewColor(oBrw1)
   aDat1:=Select_Colors_Type()
   oBrw1:setarray(aDat1)
   oBrw1:refresh()

RETURN NIL


//------------- BMP-Brush ( image-preview ) -----------

FUNCTION DRAW_BMP( oBitmap, hDC, nColor )
LOCAL oBMPBrush
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )

DEFINE BRUSH oBMPBrush COLOR nColor
FillRect( oBitmap:hDC, aRect, oBMPBrush:hBrush )
oBMPBrush:End()

RETURN( NIL )

// ------------- IMAGES - and COLOR-STRINGS -update ------

FUNCTION RGB_UPD2( oDlg, nColor, cColor,oTextRGB )
LOCAL nBlue, nGreen, nRed

nRed := nRGBRed( nColor )
nGreen := nRGBGreen( nColor )
nBlue := nRGBBlue( nColor )

// Color-Image
// ---------------
nResRGB := nColor
oResRGB:Refresh()

// color-value ( numeric )
// ---------------------------
nValRGB := nColor
*oValRGB:Refresh()

// RGB-color-string
// -------------------
cTextRGB := "nRGB( " + ALLTRIM(STR(nRed)) + ", " + ;
     ALLTRIM(STR(nGreen)) + ", " + ;
     ALLTRIM(STR(nBlue)) + " )"

           oTextRGB:SetText(cTextRGB)

RETURN NIL





 Function InitColorsArray()

 aColors := { ;
 {"Snow", "255 250 250"} ,;
 {"GhostWhite", "248 248 255"} ,;
 {"WhiteSmoke", "245 245 245"} ,;
 {"Gainsboro", "220 220 220"} ,;
 {"FloralWhite", "255 250 240"} ,;
 {"OldLace", "253 245 230"} ,;
 {"Linen", "250 240 230"} ,;
 {"AntiqueWhite", "250 235 215"} ,;
 {"PapayaWhip", "255 239 213"} ,;
 {"BlanchedAlmond", "255 235 205"} ,;
 {"Bisque", "255 228 196"} ,;
 {"PeachPuff", "255 218 185"} ,;
 {"NavajoWhite", "255 222 173"} ,;
 {"Moccasin", "255 228 181"} ,;
 {"Cornsilk", "255 248 220"} ,;
 {"Ivory", "255 255 240"} ,;
 {"LemonChiffon", "255 250 205"} ,;
 {"Seashell", "255 245 238"} ,;
 {"Honeydew", "240 255 240"} ,;
 {"MintCream", "245 255 250"} ,;
 {"Azure", "240 255 255"} ,;
 {"AliceBlue", "240 248 255"} ,;
 {"Lavender", "230 230 250"} ,;
 {"LavenderBlush", "255 240 245"} ,;
 {"MistyRose", "255 228 225"} ,;
 {"White", "255 255 255"} ,;
 {"Black", "0 0 0"} ,;
 {"DarkSlateGray", "47 79 79"} ,;
 {"DimGrey", "105 105 105"} ,;
 {"SlateGrey", "112 128 144"} ,;
 {"LightSlateGray", "119 136 153"} ,;
 {"Grey", "190 190 190"} ,;
 {"LightGray", "211 211 211"} ,;
 {"MidnightBlue", "25 25 112"} ,;
 {"NavyBlue (Navy)", "0 0 128"} ,;
 {"CornflowerBlue", "100 149 237"} ,;
 {"DarkSlateBlue", "72 61 139"} ,;
 {"SlateBlue", "106 90 205"} ,;
 {"MediumSlateBlue", "123 104 238"} ,;
 {"LightSlateBlue", "132 112 255"} ,;
 {"MediumBlue", "0 0 205"} ,;
 {"RoyalBlue", "65 105 225"} ,;
 {"Blue", "0 0 255"} ,;
 {"DodgerBlue", "30 144 255"} ,;
 {"DeepSkyBlue", "0 191 255"} ,;
 {"SkyBlue", "135 206 235"} ,;
 {"LightSkyBlue", "135 206 250"} ,;
 {"SteelBlue", "70 130 180"} ,;
 {"LightSteelBlue", "176 196 222"} ,;
 {"LightBlue", "173 216 230"} ,;
 {"PowderBlue", "176 224 230"} ,;
 {"PaleTurquoise", "175 238 238"} ,;
 {"DarkTurquoise", "0 206 209"} ,;
 {"MediumTurquoise", "72 209 204"} ,;
 {"Turquoise", "64 224 208"} ,;
 {"Cyan", "0 255 255"} ,;
 {"LightCyan", "224 255 255"} ,;
 {"CadetBlue", "95 158 160"} ,;
 {"MediumAquamarine", "102 205 170"} ,;
 {"Aquamarine", "127 255 212"} ,;
 {"DarkGreen", "0 100 0"} ,;
 {"DarkOliveGreen", "85 107 47"} ,;
 {"DarkSeaGreen", "143 188 143"} ,;
 {"SeaGreen", "46 139 87"} ,;
 {"MediumSeaGreen", "60 179 113"} ,;
 {"LightSeaGreen", "32 178 170"} ,;
 {"PaleGreen", "152 251 152"} ,;
 {"SpringGreen", "0 255 127"} ,;
 {"LawnGreen", "124 252 0"} ,;
 {"Green", "0 255 0"} ,;
 {"Chartreuse", "127 255 0"} ,;
 {"MediumSpringGreen", "0 250 154"} ,;
 {"GreenYellow", "173 255 47"} ,;
 {"LimeGreen", "50 205 50"} ,;
 {"YellowGreen", "154 205 50"} ,;
 {"ForestGreen", "34 139 34"} ,;
 {"OliveDrab", "107 142 35"} ,;
 {"DarkKhaki", "189 183 107"} ,;
 {"Khaki", "240 230 140"} ,;
 {"PaleGoldenrod", "238 232 170"} ,;
 {"LightGoldenrodYellow", "250 250 210"} ,;
 {"LightYellow", "255 255 224"} ,;
 {"Yellow", "255 255 0"} ,;
 {"Gold", "255 215 0"} ,;
 {"LightGoldenrod", "238 221 130"} ,;
 {"Goldenrod", "218 165 32"} ,;
 {"DarkGoldenrod", "184 134 11"} ,;
 {"RosyBrown", "188 143 143"} ,;
 {"IndianRed", "205 92 92"} ,;
 {"SaddleBrown", "139 69 19"} ,;
 {"Sienna", "160 82 45"} ,;
 {"Peru", "205 133 63"} ,;
 {"Burlywood", "222 184 135"} ,;
 {"Beige", "245 245 220"} ,;
 {"Wheat", "245 222 179"} ,;
 {"SandyBrown", "244 164 96"} ,;
 {"Tan", "210 180 140"} ,;
 {"Chocolate", "210 105 30"} ,;
 {"Firebrick", "178 34 34"} ,;
 {"Brown", "165 42 42"} ,;
 {"DarkSalmon", "233 150 122"} ,;
 {"Salmon", "250 128 114"} ,;
 {"LightSalmon", "255 160 122"} ,;
 {"Orange", "255 165 0"} ,;
 {"DarkOrange", "255 140 0"} ,;
 {"Coral", "255 127 80"} ,;
 {"LightCoral", "240 128 128"} ,;
 {"Tomato", "255 99 71"} ,;
 {"OrangeRed", "255 69 0"} ,;
 {"Red", "255 0 0"} ,;
 {"HotPink", "255 105 180"} ,;
 {"DeepPink", "255 20 147"} ,;
 {"Pink", "255 192 203"} ,;
 {"LightPink", "255 182 193"} ,;
 {"PaleVioletRed", "219 112 147"} ,;
 {"Maroon", "176 48 96"} ,;
 {"MediumVioletRed", "199 21 133"} ,;
 {"VioletRed", "208 32 144"} ,;
 {"Magenta", "255 0 255"} ,;
 {"Violet", "238 130 238"} ,;
 {"Plum", "221 160 221"} ,;
 {"Orchid", "218 112 214"} ,;
 {"MediumOrchid", "186 85 211"} ,;
 {"DarkOrchid", "153 50 204"} ,;
 {"BlueViolet", "138 43 226"} ,;
 {"Purple", "160 32 240"} ,;
 {"MediumPurple", "147 112 219"} ,;
 {"Thistle", "216 191 216"} ,;
 {"Snow1", "255 250 250"} ,;
 {"Snow2", "238 233 233"} ,;
 {"Snow3", "205 201 201"} ,;
 {"Snow4", "139 137 137"} ,;
 {"Seashell1", "255 245 238"} ,;
 {"Seashell2", "238 229 222"} ,;
 {"Seashell3", "205 197 191"} ,;
 {"Seashell4", "139 134 130"} ,;
 {"AntiqueWhite1", "255 239 219"} ,;
 {"AntiqueWhite2", "238 223 204"} ,;
 {"AntiqueWhite3", "205 192 176"} ,;
 {"AntiqueWhite4", "139 131 120"} ,;
 {"Bisque1", "255 228 196"} ,;
 {"Bisque2", "238 213 183"} ,;
 {"Bisque3", "205 183 158"} ,;
 {"Bisque4", "139 125 107"} ,;
 {"PeachPuff1", "255 218 185"} ,;
 {"PeachPuff2", "238 203 173"} ,;
 {"PeachPuff3", "205 175 149"} ,;
 {"PeachPuff4", "139 119 101"} ,;
 {"NavajoWhite1", "255 222 173"} ,;
 {"NavajoWhite2", "238 207 161"} ,;
 {"NavajoWhite3", "205 179 139"} ,;
 {"NavajoWhite4", "139 121 94"} ,;
 {"LemonChiffon1", "255 250 205"} ,;
 {"LemonChiffon2", "238 233 191"} ,;
 {"LemonChiffon3", "205 201 165"} ,;
 {"LemonChiffon4", "139 137 112"} ,;
 {"Cornsilk1", "255 248 220"} ,;
 {"Cornsilk2", "238 232 205"} ,;
 {"Cornsilk3", "205 200 177"} ,;
 {"Cornsilk4", "139 136 120"} ,;
 {"Ivory1", "255 255 240"} ,;
 {"Ivory2", "238 238 224"} ,;
 {"Ivory3", "205 205 193"} ,;
 {"Ivory4", "139 139 131"} ,;
 {"Honeydew1", "240 255 240"} ,;
 {"Honeydew2", "224 238 224"} ,;
 {"Honeydew3", "193 205 193"} ,;
 {"Honeydew4", "131 139 131"} ,;
 {"LavenderBlush1", "255 240 245"} ,;
 {"LavenderBlush2", "238 224 229"} ,;
 {"LavenderBlush3", "205 193 197"} ,;
 {"LavenderBlush4", "139 131 134"} ,;
 {"MistyRose1", "255 228 225"} ,;
 {"MistyRose2", "238 213 210"} ,;
 {"MistyRose3", "205 183 181"} ,;
 {"MistyRose4", "139 125 123"} ,;
 {"Azure1", "240 255 255"} ,;
 {"Azure2", "224 238 238"} ,;
 {"Azure3", "193 205 205"} ,;
 {"Azure4", "131 139 139"} ,;
 {"SlateBlue1", "131 111 255"} ,;
 {"SlateBlue2", "122 103 238"} ,;
 {"SlateBlue3", "105 89 205"} ,;
 {"SlateBlue4", "71 60 139"} ,;
 {"RoyalBlue1", "72 118 255"} ,;
 {"RoyalBlue2", "67 110 238"} ,;
 {"RoyalBlue3", "58 95 205"} ,;
 {"RoyalBlue4", "39 64 139"} ,;
 {"Blue1", "0 0 255"} ,;
 {"Blue2", "0 0 238"} ,;
 {"Blue3", "0 0 205"} ,;
 {"Blue4", "0 0 139"} ,;
 {"DodgerBlue1", "30 144 255"} ,;
 {"DodgerBlue2", "28 134 238"} ,;
 {"DodgerBlue3", "24 116 205"} ,;
 {"DodgerBlue4", "16 78 139"} ,;
 {"SteelBlue1", "99 184 255"} ,;
 {"SteelBlue2", "92 172 238"} ,;
 {"SteelBlue3", "79 148 205"} ,;
 {"SteelBlue4", "54 100 139"} ,;
 {"DeepSkyBlue1", "0 191 255"} ,;
 {"DeepSkyBlue2", "0 178 238"} ,;
 {"DeepSkyBlue3", "0 154 205"} ,;
 {"DeepSkyBlue4", "0 104 139"} ,;
 {"SkyBlue1", "135 206 255"} ,;
 {"SkyBlue2", "126 192 238"} ,;
 {"SkyBlue3", "108 166 205"} ,;
 {"SkyBlue4", "74 112 139"} ,;
 {"LightSkyBlue1", "176 226 255"} ,;
 {"LightSkyBlue2", "164 211 238"} ,;
 {"LightSkyBlue3", "141 182 205"} ,;
 {"LightSkyBlue4", "96 123 139"} ,;
 {"SlateGray1", "198 226 255"} ,;
 {"SlateGray2", "185 211 238"} ,;
 {"SlateGray3", "159 182 205"} ,;
 {"SlateGray4", "108 123 139"} ,;
 {"LightSteelBlue1", "202 225 255"} ,;
 {"LightSteelBlue2", "188 210 238"} ,;
 {"LightSteelBlue3", "162 181 205"} ,;
 {"LightSteelBlue4", "110 123 139"} ,;
 {"LightBlue1", "191 239 255"} ,;
 {"LightBlue2", "178 223 238"} ,;
 {"LightBlue3", "154 192 205"} ,;
 {"LightBlue4", "104 131 139"} ,;
 {"LightCyan1", "224 255 255"} ,;
 {"LightCyan2", "209 238 238"} ,;
 {"LightCyan3", "180 205 205"} ,;
 {"LightCyan4", "122 139 139"} ,;
 {"PaleTurquoise1", "187 255 255"} ,;
 {"PaleTurquoise2", "174 238 238"} ,;
 {"PaleTurquoise3", "150 205 205"} ,;
 {"PaleTurquoise4", "102 139 139"} ,;
 {"CadetBlue1", "152 245 255"} ,;
 {"CadetBlue2", "142 229 238"} ,;
 {"CadetBlue3", "122 197 205"} ,;
 {"CadetBlue4", "83 134 139"} ,;
 {"Turquoise1", "0 245 255"} ,;
 {"Turquoise2", "0 229 238"} ,;
 {"Turquoise3", "0 197 205"} ,;
 {"Turquoise4", "0 134 139"} ,;
 {"Cyan1", "0 255 255"} ,;
 {"Cyan2", "0 238 238"} ,;
 {"Cyan3", "0 205 205"} ,;
 {"Cyan4", "0 139 139"} ,;
 {"DarkSlateGray1", "151 255 255"} ,;
 {"DarkSlateGray2", "141 238 238"} ,;
 {"DarkSlateGray3", "121 205 205"} ,;
 {"DarkSlateGray4", "82 139 139"} ,;
 {"Aquamarine1", "127 255 212"} ,;
 {"Aquamarine2", "118 238 198"} ,;
 {"Aquamarine3", "102 205 170"} ,;
 {"Aquamarine4", "69 139 116"} ,;
 {"DarkSeaGreen1", "193 255 193"} ,;
 {"DarkSeaGreen2", "180 238 180"} ,;
 {"DarkSeaGreen3", "155 205 155"} ,;
 {"DarkSeaGreen4", "105 139 105"} ,;
 {"SeaGreen1", "84 255 159"} ,;
 {"SeaGreen2", "78 238 148"} ,;
 {"SeaGreen3", "67 205 128"} ,;
 {"SeaGreen4", "46 139 87"} ,;
 {"PaleGreen1", "154 255 154"} ,;
 {"PaleGreen2", "144 238 144"} ,;
 {"PaleGreen3", "124 205 124"} ,;
 {"PaleGreen4", "84 139 84"} ,;
 {"SpringGreen1", "0 255 127"} ,;
 {"SpringGreen2", "0 238 118"} ,;
 {"SpringGreen3", "0 205 102"} ,;
 {"SpringGreen4", "0 139 69"} ,;
 {"Green1", "0 255 0"} ,;
 {"Green2", "0 238 0"} ,;
 {"Green3", "0 205 0"} ,;
 {"Green4", "0 139 0"} ,;
 {"Chartreuse1", "127 255 0"} ,;
 {"Chartreuse2", "118 238 0"} ,;
 {"Chartreuse3", "102 205 0"} ,;
 {"Chartreuse4", "69 139 0"} ,;
 {"OliveDrab1", "192 255 62"} ,;
 {"OliveDrab2", "179 238 58"} ,;
 {"OliveDrab3", "154 205 50"} ,;
 {"OliveDrab4", "105 139 34"} ,;
 {"DarkOliveGreen1", "202 255 112"} ,;
 {"DarkOliveGreen2", "188 238 104"} ,;
 {"DarkOliveGreen3", "162 205 90"} ,;
 {"DarkOliveGreen4", "110 139 61"} ,;
 {"Khaki1", "255 246 143"} ,;
 {"Khaki2", "238 230 133"} ,;
 {"Khaki3", "205 198 115"} ,;
 {"Khaki4", "139 134 78"} ,;
 {"LightGoldenrod1", "255 236 139"} ,;
 {"LightGoldenrod2", "238 220 130"} ,;
 {"LightGoldenrod3", "205 190 112"} ,;
 {"LightGoldenrod4", "139 129 76"} ,;
 {"LightYellow1", "255 255 224"} ,;
 {"LightYellow2", "238 238 209"} ,;
 {"LightYellow3", "205 205 180"} ,;
 {"LightYellow4", "139 139 122"} ,;
 {"Yellow1", "255 255 0"} ,;
 {"Yellow2", "238 238 0"} ,;
 {"Yellow3", "205 205 0"} ,;
 {"Yellow4", "139 139 0"} ,;
 {"Gold1", "255 215 0"} ,;
 {"Gold2", "238 201 0"} ,;
 {"Gold3", "205 173 0"} ,;
 {"Gold4", "139 117 0"} ,;
 {"Goldenrod1", "255 193 37"} ,;
 {"Goldenrod2", "238 180 34"} ,;
 {"Goldenrod3", "205 155 29"} ,;
 {"Goldenrod4", "139 105 20"} ,;
 {"DarkGoldenrod1", "255 185 15"} ,;
 {"DarkGoldenrod2", "238 173 14"} ,;
 {"DarkGoldenrod3", "205 149 12"} ,;
 {"DarkGoldenrod4", "139 101 8"} ,;
 {"RosyBrown1", "255 193 193"} ,;
 {"RosyBrown2", "238 180 180"} ,;
 {"RosyBrown3", "205 155 155"} ,;
 {"RosyBrown4", "139 105 105"} ,;
 {"IndianRed1", "255 106 106"} ,;
 {"IndianRed2", "238 99 99"} ,;
 {"IndianRed3", "205 85 85"} ,;
 {"IndianRed4", "139 58 58"} ,;
 {"Sienna1", "255 130 71"} ,;
 {"Sienna2", "238 121 66"} ,;
 {"Sienna3", "205 104 57"} ,;
 {"Sienna4", "139 71 38"} ,;
 {"Burlywood1", "255 211 155"} ,;
 {"Burlywood2", "238 197 145"} ,;
 {"Burlywood3", "205 170 125"} ,;
 {"Burlywood4", "139 115 85"} ,;
 {"Wheat1", "255 231 186"} ,;
 {"Wheat2", "238 216 174"} ,;
 {"Wheat3", "205 186 150"} ,;
 {"Wheat4", "139 126 102"} ,;
 {"Tan1", "255 165 79"} ,;
 {"Tan2", "238 154 73"} ,;
 {"Tan3", "205 133 63"} ,;
 {"Tan4", "139 90 43"} ,;
 {"Chocolate1", "255 127 36"} ,;
 {"Chocolate2", "238 118 33"} ,;
 {"Chocolate3", "205 102 29"} ,;
 {"Chocolate4", "139 69 19"} ,;
 {"Firebrick1", "255 48 48"} ,;
 {"Firebrick2", "238 44 44"} ,;
 {"Firebrick3", "205 38 38"} ,;
 {"Firebrick4", "139 26 26"} ,;
 {"Brown1", "255 64 64"} ,;
 {"Brown2", "238 59 59"} ,;
 {"Brown3", "205 51 51"} ,;
 {"Brown4", "139 35 35"} ,;
 {"Salmon1", "255 140 105"} ,;
 {"Salmon2", "238 130 98"} ,;
 {"Salmon3", "205 112 84"} ,;
 {"Salmon4", "139 76 57"} ,;
 {"LightSalmon1", "255 160 122"} ,;
 {"LightSalmon2", "238 149 114"} ,;
 {"LightSalmon3", "205 129 98"} ,;
 {"LightSalmon4", "139 87 66"} ,;
 {"Orange1", "255 165 0"} ,;
 {"Orange2", "238 154 0"} ,;
 {"Orange3", "205 133 0"} ,;
 {"Orange4", "139 90 0"} ,;
 {"DarkOrange1", "255 127 0"} ,;
 {"DarkOrange2", "238 118 0"} ,;
 {"DarkOrange3", "205 102 0"} ,;
 {"DarkOrange4", "139 69 0"} ,;
 {"Coral1", "255 114 86"} ,;
 {"Coral2", "238 106 80"} ,;
 {"Coral3", "205 91 69"} ,;
 {"Coral4", "139 62 47"} ,;
 {"Tomato1", "255 99 71"} ,;
 {"Tomato2", "238 92 66"} ,;
 {"Tomato3", "205 79 57"} ,;
 {"Tomato4", "139 54 38"} ,;
 {"OrangeRed1", "255 69 0"} ,;
 {"OrangeRed2", "238 64 0"} ,;
 {"OrangeRed3", "205 55 0"} ,;
 {"OrangeRed4", "139 37 0"} ,;
 {"Red1", "255 0 0"} ,;
 {"Red2", "238 0 0"} ,;
 {"Red3", "205 0 0"} ,;
 {"Red4", "139 0 0"} ,;
 {"DeepPink1", "255 20 147"} ,;
 {"DeepPink2", "238 18 137"} ,;
 {"DeepPink3", "205 16 118"} ,;
 {"DeepPink4", "139 10 80"} ,;
 {"HotPink1", "255 110 180"} ,;
 {"HotPink2", "238 106 167"} ,;
 {"HotPink3", "205 96 144"} ,;
 {"HotPink4", "139 58 98"} ,;
 {"Pink1", "255 181 197"} ,;
 {"Pink2", "238 169 184"} ,;
 {"Pink3", "205 145 158"} ,;
 {"Pink4", "139 99 108"} ,;
 {"LightPink1", "255 174 185"} ,;
 {"LightPink2", "238 162 173"} ,;
 {"LightPink3", "205 140 149"} ,;
 {"LightPink4", "139 95 101"} ,;
 {"PaleVioletRed1", "255 130 171"} ,;
 {"PaleVioletRed2", "238 121 159"} ,;
 {"PaleVioletRed3", "205 104 137"} ,;
 {"PaleVioletRed4", "139 71 93"} ,;
 {"Maroon1", "255 52 179"} ,;
 {"Maroon2", "238 48 167"} ,;
 {"Maroon3", "205 41 144"} ,;
 {"Maroon4", "139 28 98"} ,;
 {"VioletRed1", "255 62 150"} ,;
 {"VioletRed2", "238 58 140"} ,;
 {"VioletRed3", "205 50 120"} ,;
 {"VioletRed4", "139 34 82"} ,;
 {"Magenta1", "255 0 255"} ,;
 {"Magenta2", "238 0 238"} ,;
 {"Magenta3", "205 0 205"} ,;
 {"Magenta4", "139 0 139"} ,;
 {"Orchid1", "255 131 250"} ,;
 {"Orchid2", "238 122 233"} ,;
 {"Orchid3", "205 105 201"} ,;
 {"Orchid4", "139 71 137"} ,;
 {"Plum1", "255 187 255"} ,;
 {"Plum2", "238 174 238"} ,;
 {"Plum3", "205 150 205"} ,;
 {"Plum4", "139 102 139"} ,;
 {"MediumOrchid1", "224 102 255"} ,;
 {"MediumOrchid2", "209 95 238"} ,;
 {"MediumOrchid3", "180 82 205"} ,;
 {"MediumOrchid4", "122 55 139"} ,;
 {"DarkOrchid1", "191 62 255"} ,;
 {"DarkOrchid2", "178 58 238"} ,;
 {"DarkOrchid3", "154 50 205"} ,;
 {"DarkOrchid4", "104 34 139"} ,;
 {"Purple1", "155 48 255"} ,;
 {"Purple2", "145 44 238"} ,;
 {"Purple3", "125 38 205"} ,;
 {"Purple4", "85 26 139"} ,;
 {"MediumPurple1", "171 130 255"} ,;
 {"MediumPurple2", "159 121 238"} ,;
 {"MediumPurple3", "137 104 205"} ,;
 {"MediumPurple4", "93 71 139"} ,;
 {"Thistle1", "255 225 255"} ,;
 {"Thistle2", "238 210 238"} ,;
 {"Thistle3", "205 181 205"} ,;
 {"Thistle4", "139 123 139"} ,;
 {"grey11", "28 28 28"} ,;
 {"grey21", "54 54 54"} ,;
 {"grey31", "79 79 79"} ,;
 {"grey41", "105 105 105"} ,;
 {"grey51", "130 130 130"} ,;
 {"grey61", "156 156 156"} ,;
 {"grey71", "181 181 181"} ,;
 {"grey81", "207 207 207"} ,;
 {"grey91", "232 232 232"} ,;
 {"DarkGrey", "169 169 169"} ,;
 {"DarkBlue", "0 0 139"} ,;
 {"DarkCyan", "0 139 139"} ,;
 {"DarkMagenta", "139 0 139"} ,;
 {"DarkRed", "139 0 0"} ,;
 {"LightGreen", "144 238 144"} }

Return aColors



   Function GetBackNumColor( aColors,n )
       Local nR, nG, nB
       cColor := aColors[n][ 2 ]
       nR := Val( Token( cColor, " ", 1 ) )
       nG := Val( Token( cColor, " ", 2 ) )
       nB := Val( Token( cColor, " ", 3 ) )
    return    (nR + ( nG * 256 ) + ( nB * 65536 ))




     Function GetBackColor( aColors,n )
       Local nR, nG, nB
       cColor := aColors[n][ 2 ]
       nR := Val( Token( cColor, " ", 1 ) )
       nG := Val( Token( cColor, " ", 2 ) )
       nB := Val( Token( cColor, " ", 3 ) )
       nColor:= 'RBG('+str(nR)+','+str(nG)+','+ str(nB)+')'
       return  nColor




 Function InitColorsArray_Metro()
    aColors := { ;
       {"METRO_LIME    ", "164 196   0"} ,;
       {"METRO_GREEN   ", "96  169  23"} ,;
       {"METRO_EMERALD ", "0   138   0"} ,;
       {"METRO_TEAL    ", "0   171 169"} ,;
       {"METRO_CYAN    ", "27  161 226"} ,;
       {"METRO_COBALT  ", "0    80 239"} ,;
       {"METRO_INDIGO  ", "106   0 255"} ,;
       {"METRO_VIOLET  ", "170   0 255"} ,;
       {"METRO_PINK    ", "244 114 208"} ,;
       {"METRO_MAGENTA ", "216   0 115"} ,;
       {"METRO_CRIMSON ", "162   0  37"} ,;
       {"METRO_RED     ", "229  20   0"} ,;
       {"METRO_ORANGE  ", "250 104   0"} ,;
       {"METRO_AMBER   ", "240 163  10"} ,;
       {"METRO_YELLOW  ", "227 200   0"} ,;
       {"METRO_BROWN   ", "130  90  44"} ,;
       {"METRO_OLIVE   ", "109 135 100"} ,;
       {"METRO_STEEL   ", "100 118 135"} ,;
       {"METRO_MAUVE   ", "118  96 138"} ,;
       {"METRO_TAUPE   ", "135 121  78"} }

Return aColors







      Function Select_Colors_Type(oBrw)
        Local oDlgSelect
        Local aColors := {}
        Local nBottom   := 12
        Local nRight    := 44
        Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
        Local nHeight := nBottom * DLG_CHARPIX_H
        Local ncolor:= 0
        Local aTempDat := {}

        DEFINE DIALOG oDlgSelect        ;
        TITLE "Select color type"   ;
        SIZE nWidth, nHeight  PIXEL

        @ 1,1 BUTTON "Metro colors" SIZE 60,10 OF oDlgSelect PIXEL  ACTION  ( nColor:=1, oDlgSelect:end( IDOK ) )
        @ 15,1 BUTTON "Windows colors" SIZE 60,10 OF oDlgSelect PIXEL  ACTION  ( nColor:=2, oDlgSelect:end( IDOK ) )

        ACTIVATE DIALOG oDlgSelect center

          IF oDlgSelect:nresult == IDOK
             DO CASE
                CASE  nColor = 1
                   aColors:= InitColorsArray_Metro()
                CASE ncolor = 2
                   aColors:=  InitColorsArray()
              ENDCASE


        For n= 1 to Len( aColors )
          AaDd( aTempDat,{"",aColors[n][1], GetBackColor(aColors,n), GetBackNumColor(aColors,n)  } )
        next

     ENDIF

     adel(aColors)
     asort( aTempDat)
 return aTempDat
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6766
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 8 guests