![]() |
|
|||||||
| Programming User to user discussions of general programming topics such as algorithms, APIs, etc. |
![]() |
|
|
Thread Tools | Display Modes |
|
#31
|
|||
|
|||
|
Dave, I finally got the gradients I wanted (sort of) by generating them.
Code:
Sub Generate_Colors
aa_common_Locals
Local Color_Range, Num_Colors, Doing_Color As Long
stp = 5
Num_Colors = 7
Color_Range = 50
Num_Elements = Num_Colors * Color_Range
Dim ColorArray(1 To Num_Elements) As Colors_Array
'
While Doing_Color < Num_Colors
Incr Doing_Color
For ctr = 0 To (Color_Range * Stp) - 1 Step stp
If i = Num_Elements Then Exit For 'JIC array limit reached
Incr i
Select Case Doing_Color
Case 1 ' FF 00 00
l$ = "Red" : r = &hFF: g = ctr: b = ctr
bg = %White: If ctr1 > 25 Then bg = %Black
Case 2 ' 00 00 FF
l$ = "Blue" : r = ctr: g = ctr: b = &hFF
bg = %White: If ctr1 > 25 Then bg = %Black
Case 3 ' 00 FF 00
l$ = "Green": r = ctr: g = &hFF: b = Ctr
bg = %White: If ctr1 > 15 Then bg = %Black
Case 4 'FF FF 00
l$ = "Yellow": r = &hFF: g = &hFF: b = ctr
bg = %Black
Case 5 '00 FF FF
l$ = "Cyan" : r = ctr: g = &hFF: b = 255
bg = %Black
Case 6 'FF 00 FF
l$ = "Magenta": r = 255: g = ctr: b = 255
bg = %White: If ctr1 > 15 Then bg = %Black
Case 7 'Black = &H000000
l$ = "Grays": r = ctr: g = ctr: b = ctr
bg = %White: If ctr1 > 35 Then bg = %Black
End Select
GoSub Assign_it
Next ctr
Reset ctr1 'color range ctr for name
If i = Num_Elements Then GoTo Done 'JIC array limit reached
Wend
Done:
g_Colors_in_Array = i
Exit Sub
'**************
Assign_it:
dv = RGB(r, g, b)
Incr ctr1
ColorArray(i).Order = i
ColorArray(i).Sort_by = Using$("#######", i)
ColorArray(i).Value = dv
ColorArray(i).bg_Color = bg
ColorArray(i).Color_Actual_Name = l$ & Using$("#########", ctr1)
ColorArray(i).Display_Name = _
Hex$(r, 2) & " " & Hex$(g, 2) & " " & Hex$(b, 2) & " - " & _
MCase$(l$) & Using$(" ### ", ctr1)
Return
End Sub
'
' *******************************************************
============================================== "Every truth goes through three stages before it is recognized. In the first, it is ridiculed. In the second, it is opposed. In the third it is regarded as self evident." Arthur Schopenhauer ==============================================
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml |
|
#32
|
|||
|
|||
|
Gösta,
Very nice .I only had a quick look at implementing that distance algorithm today but it looks like it will sort the colors in the ColorArray according to 'brightness' only - not by color which is what I was hoping for. More research required!
__________________
Rgds, Dave |
|
#33
|
|||
|
|||
|
I got the gradient color idea from a free program I found years ago somewhere called "Absolute Color Picker". One feature has slide bars that display the RGB values and the associated color. Pretty cool program actually.
======================================== Poetry is rather an approach to things, to life, than it is typographical production. Joseph Brodsky ========================================
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml |
|
#34
|
|||
|
|||
|
Quote:
I even have a link to it on my Start/Programs/Software Development/Utilities menu. MCM |
|
#35
|
|||
|
|||
|
Quote:
It would be really cool if the buttons could be sorted into a range of hues say from Lightest to Darkest like Dave was talking about, but that's beyond me just now. Also be neat to have a Dialog/Control to add/delete colors/hues, but that's down the road a ways I think. I want to clean this code up first. I don't want to get involved with handling external files (ini, parameter, data, ..) just yet. Much cleaner to just have 1 file (Color_Button.exe)
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml Last edited by Gösta H. Lovgren-2; Jun 10th, 2009 at 12:34 AM. Reason: Deleted "old" code |
|
#36
|
|||
|
|||
|
Here's the latest. Code is attached. Pretty easy to add/delete color buttons in Sub Generate_Colors. I expect I'll be adding more as time goes on (currently 426).
The Color_Buttons.exe can be found at Free programs (see signature - Not to worry M, the signature's not any longer. Once chastised, I'm forever chastened.). Now all that's needed is for Dave to perfect color weighting (Light to dark) to use in the weight sort. (it's not very useful just now) {hint, hint, grin}. A phenomenon I noticed is that when the text color changes, the bg color appears to brighten significantly (usually). I know it doesn't actually and it's just the way the/my eyes see the contrast. Just kinda neat is all. Something graphic artists surely know. (hmmm... just gave me an idea how to demonstrate it. But not tonight. Kinda depressed. Yankees lost to the Red Sox tonight. D... that David Ortiz.) ==================================== "I can write better than anybody who can write faster, and I can write faster than anybody who can write better." A. J. Liebling (1904-1963) ====================================
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml Last edited by Gösta H. Lovgren-2; Jun 10th, 2009 at 01:00 AM. |
|
#37
|
|||
|
|||
|
Quote:
![]() Been a little distracted as I wanted to look into the different color mix modes that are available (remember that's what started this thread ).I wrote a little app to try to help get my head around 'Mixing', 'Merging' and color averaging etc.. You can see the result to date here: http://www.powerbasic.com/support/pb...758#post316758 Meanwhile, the Color Sort routine is far from perfected as you can see from this: Code:
Data Black, 0 Data Grey1, 197379 Data Grey2, 328965 Data Grey3, 526344 Data Grey4, 657930 Data Grey5, 855309 Data Grey6, 986895 Data Grey7, 1184274 Data Grey8, 1315860 Data Grey9, 1513239 Data Grey10, 1710618 Data Grey11, 1842204 Data Grey12, 2039583 Data Grey13, 2171169 Data Grey14, 2368548 Data Grey15, 2500134 Data Grey16, 2697513 Data Grey17, 2829099 Data Grey18, 3026478 Data Grey19, 3158064 Data Grey20, 3355443 Data Grey21, 3552822 Data Grey22, 3684408 Data Grey23, 3881787 Data Grey24, 4013373 Data Grey25, 4210752 Data Maroon, 128 Data Grey26, 4342338 Data Darkgreen, 25600 Data Green Dark, 25600 Data Midnightblue, 7346457 Data Blue Midnight, 7346457 Data Grey27, 4539717 Data Dark Red, 139 Data Grey28, 4671303 Data Darkslategrey, 5197615 Data Gray Dark Slate, 5197615 Data Firebrick4, 1710731 Data Grey29, 4868682 Data Orangered4, 9611 Data Navy, 8388608 Data Navyblue, 8388608 Data Blue Navy, 8388608 Data Brown4, 2302859 Data Grey30, 5066061 Data Grey31, 5197647 Data Blue4, 9109504 Data Blue Dark, 9109504 Data Tomato4, 2504331 Data Indigo, 8519755 Data Grey32, 5395026 Data Deeppink4, 5245579 Data Darkorange4, 17803 Data Grey33, 5526612 Data Chocolate4, 1262987 Data Saddlebrown, 1262987 Data Brown Saddle, 1262987 Data Coral4, 3096203 Data Green, 32768 Data Indianred4, 3816075 Data Violetred4, 5382795 Data Darkolivegreen, 3107669 Data Olive Green Dark, 3107669 Data Grey34, 5723991 Data Sienna4, 2508683 Data Grey35, 5855577 Data Purple4, 9116245 Data Maroon4, 6429835 Data Brown, 2763429 Data Brown, 2763429 Data Salmon4, 3755147 Data Grey36, 6052956 Data Orange4, 23179 Data Royalblue4, 9125927 Data Green4, 35584 Data Grey37, 6184542 Data Slateblue4, 9124935 Data Tan4, 2841227 Data Darkslateblue, 9125192 Data Slate Blue Dark, 9125192 Data Firebrick, 2237106 Data Purple, 8388736 Data Red Fire Brick, 2237106 Data Darkorchid4, 9118312 Data Dodgerblue4, 9129488 Data Forestgreen, 2263842 Data Green Forest, 2263842 Data Hotpink4, 6437515 Data Grey38, 6381921 Data Darkgoldenrod4, 550283 Data Lightsalmon4, 4347787 Data Palevioletred4, 6113163 Data Chartreuse4, 35653 Data Grey39, 6513507 Data Goldenrod4, 1337739 Data Springgreen4, 4557568 Data Sienna, 2970272 Data Sienna, 2970272 Data Grey40, 6710886 Data Mediumpurple4, 9127773 Data Magenta4, 9109643 Data Magenta Dark, 9109643 Data Mediumorchid4, 9123706 Data Gold4, 30091 Data Grey41, 6908265 Data Dimgrey, 6908265 Data Gray Dim, 6908265 Data Red3, 205 Data Deepskyblue4, 9136128 Data Steelblue4, 9135158 Data Olive, 32896 Data Grey42, 7039851 Data Seagreen4, 5737262 Data Seagreen, 5737262 Data Green Sea, 5737262 Data Olivedrab4, 2263913 Data Maroon, 6303920 Data Lightpink4, 6643595 Data Grey43, 7237230 Data Olivedrab, 2330219 Data Olive Drab, 2330219 Data Firebrick3, 2500301 Data Palegreen4, 5540692 Data Grey44, 7368816 Data Orangered3, 14285 Data Darkolivegreen4, 4033390 Data Orchid4, 8996747 Data Pink4, 7103371 Data Teal, 8421376 Data Burlywood4, 5600139 Data Skyblue4, 9138250 Data Brown3, 3355597 Data Rosybrown4, 6908299 Data Grey45, 7566195 Data Yellow4, 35723 Data Grey46, 7697781 Data Lightgoldenrod4, 5013899 Data Aquamarine4, 7637829 Data Blue3, 13434880 Data Mediumblue, 13434880 Data Blue Medium, 13434880 Data Navajowhite4, 6191499 Data Peachpuff4, 6649739 Data Crimson, 3937500 Data Grey47, 7895160 Data Turquoise4, 9143808 Data Khaki4, 5146251 Data Darkseagreen4, 6916969 Data Grey48, 8026746 Data Tomato3, 3755981 Data Lightskyblue4, 9141088 Data Wheat4, 6717067 Data Cyan4, 9145088 Data Dark Cyan, 9145088 Data Deeppink3, 7737549 Data Bisque4, 7044491 Data Plum4, 9135755 Data Red2, 238 Data Slategray4, 9141100 Data Grey49, 8224125 Data Cadetblue4, 9143891 Data Lightsteelblue4, 9141102 Data Darkorange3, 26317 Data Mediumvioletred, 8721863 Data Violet Red Medium, 8721863 Data Chocolate3, 1926861 Data Grey50, 8355711 Data Coral3, 4545485 Data Darkslategray4, 9145170 Data Lightblue4, 9143144 Data Mistyrose4, 8093067 Data Gray, 8421504 Data Violetred3, 7877325 Data Indianred3, 5592525 Data Slategrey, 9470064 Data Gray Slate, 9470064 Data Grey51, 8553090 Data Firebrick2, 2895086 Data Antiquewhite4, 7897995 Data Darkgoldenrod, 755384 Data Goldenrod Dark, 755384 Data Sienna3, 3762381 Data Lemonchiffon4, 7375243 Data Chocolate, 1993170 Data Brown Chocolate, 1993170 Data Paleturquoise4, 9145190 Data Orangered2, 16622 Data Thistle4, 9141131 Data Purple3, 13444733 Data Cornsilk4, 7899275 Data Indianred, 6053069 Data Indian Red, 6053069 Data Grey52, 8750469 Data Maroon3, 9447885 Data Lightyellow4, 8031115 Data Lavenderblush4, 8815499 Data Seashell4, 8554123 Data Violetred, 9445584 Data Red1, 255 Data Brown2, 3881966 Data Red, 255 Data Red, 255 Data Honeydew4, 8620931 Data Grey53, 8882055 Data Lightcyan4, 9145210 Data Royalblue3, 13459258 Data Green3, 52480 Data Ivory4, 8620939 Data Salmon3, 5533901 Data Azure4, 9145219 Data Blue2, 15597568 Data Snow4, 9013643 Data Darkviolet, 13828244 Data Steelblue, 11829830 Data Lightslategrey, 10061943 Data Gray Light Slate, 10061943 Data Blue Steel, 11829830 Data Violet Dark, 13828244 Data Grey54, 9079434 Data Orange3, 34253 Data Mediumseagreen, 7451452 Data Green Medium Sea, 7451452 Data Slateblue3, 13457769 Data Slateblue, 13458026 Data Slate Blue, 13458026 Data Grey55, 9211020 Data Darkorchid, 13382297 Data Orchid Dark, 13382297 Data Firebrick1, 3158271 Data Darkorchid3, 13447834 Data Dodgerblue3, 13464600 Data Limegreen, 3329330 Data Lime Green, 3329330 Data Orangered1, 17919 Data Tan3, 4163021 Data Orangered, 17919 Data Peru, 4163021 Data Peru, 4163021 Data Orange Red, 17919 Data Grey56, 9408399 Data Tomato2, 4349166 Data Deeppink2, 8983278 Data Grey57, 9539985 Data Brown1, 4210943 Data Darkgoldenrod3, 824781 Data Blueviolet, 14822282 Data Violet Blue, 14822282 Data Black, 26777216 Data Chartreuse3, 52582 Data Hotpink3, 9461965 Data Cadetblue, 10526303 Data Blue Cadet, 10526303 Data Palevioletred3, 9005261 Data Lightsalmon3, 6455757 Data Blue1, 16711680 Data Blue, 16711680 Data Blue, 16711680 Data Darkorange2, 30446 Data Grey58, 9737364 Data Chocolate2, 2193134 Data Royalblue, 14772545 Data Blue Royal, 14772545 Data Goldenrod3, 1940429 Data Springgreen3, 6737152 Data Mediumpurple3, 13461641 Data Coral2, 5270254 Data Grey59, 9868950 Data Violetred2, 9190126 Data Indianred2, 6513646 Data Sienna2, 4356590 Data Purple2, 15608977 Data Magenta3, 13435085 Data Grey60, 10066329 Data Lightseagreen, 11186720 Data Green Sea Light, 11186720 Data Mediumorchid3, 13456052 Data Tomato1, 4678655 Data Tomato, 4678655 Data Tomato, 4678655 Data Deeppink1, 9639167 Data Purple, 15736992 Data Deeppink, 9639167 Data Pink Deep, 9639167 Data Grey61, 10263708 Data Maroon2, 10957038 Data Rosybrown, 9408444 Data Brown Rosy, 9408444 Data Steelblue3, 13472847 Data Royalblue2, 15625795 Data Gold3, 44493 Data Deepskyblue3, 13474304 Data Palevioletred, 9662683 Data Violet Red Pale, 9662683 Data Grey62, 10395294 Data Seagreen3, 8441155 Data Green2, 60928 Data Goldenrod, 2139610 Data Goldenrod, 2139610 Data Darkorange1, 32767 Data Mediumorchid, 13850042 Data Orchid Medium, 13850042 Data Olivedrab3, 3329434 Data Mediumpurple, 14381203 Data Yellowgreen, 3329434 Data Green Yellow, 3329434 Data Purple Medium, 14381203 Data Chocolate1, 2392063 Data Salmon2, 6456046 Data Slateblue2, 15624058 Data Grey63, 10592673 Data Coral1, 5665535 Data Mediumslateblue, 15624315 Data Blue Medium Slate, 15624315 Data Slate Blue Medium, 15624315 Data Violetred1, 9846527 Data Orange2, 39662 Data Indianred1, 6974207 Data Lightpink3, 9800909 Data Darkorchid2, 15612594 Data Grey64, 10724259 Data Purple1, 16724123 Data Dodgerblue2, 15631900 Data Darkorange, 36095 Data Orange Dark, 36095 Data Sienna1, 4686591 Data Coral, 5275647 Data Darkseagreen, 9419919 Data Green Sea Dark, 9419919 Data Coral, 5275647 Data Palegreen3, 8179068 Data Grey65, 10921638 Data Tan2, 4823790 Data Lightcoral, 8421616 Data Darkkhaki, 7059389 Data Khaki Dark, 7059389 Data Light Coral, 8421616 Data Orchid3, 13199821 Data Pink3, 10392013 Data Darkolivegreen3, 5950882 Data Royalblue1, 16741960 Data Maroon1, 11744511 Data Skyblue3, 13477484 Data Grey66, 11053224 Data Salmon, 7504122 Data Salmon, 7504122 Data Hotpink2, 10971886 Data Burlywood3, 8235725 Data Gray Dark, 11119017 Data Chartreuse2, 61046 Data Rosybrown3, 10197965 Data Darkgoldenrod2, 962030 Data Green1, 65280 Data Green, 65280 Data Lime, 65280 Data Lightsalmon2, 7509486 Data Darksalmon, 8034025 Data Salmon Dark, 8034025 Data Palevioletred2, 10451438 Data Grey67, 11250603 Data Slateblue1, 16740227 Data Lightslateblue, 16740484 Data Salmon1, 6917375 Data Springgreen2, 7794176 Data Cornflowerblue, 15570276 Data Blue Cornflower, 15570276 Data Grey68, 11382189 Data Mediumpurple2, 15628703 Data Yellow3, 52685 Data Orange1, 42495 Data Aquamarine3, 11193702 Data Orange, 42495 Data Mediumaquamarine, 11193702 Data Aquamarine, 11193702 Data Orange, 42495 Data Darkorchid1, 16727743 Data Goldenrod2, 2274542 Data Dodgerblue1, 16748574 Data Dodgerblue, 16748574 Data Blue Dodger, 16748574 Data Lightgoldenrod3, 7388877 Data Sandybrown, 6333684 Data Brown Sandy, 6333684 Data Grey69, 11579568 Data Navajowhite3, 9155533 Data Turquoise3, 13485312 Data Peachpuff3, 9809869 Data Magenta2, 15597806 Data Orchid, 14053594 Data Orchid, 14053594 Data Tan, 9221330 Data Tan, 9221330 Data Tan1, 5219839 Data Hotpink, 11823615 Data Pink Hot, 11823615 Data Grey70, 11776947 Data Mediumorchid2, 15622097 Data Darkseagreen3, 10210715 Data Lawngreen, 64636 Data Green Lawn, 64636 Data Hotpink1, 11824895 Data Khaki3, 7587533 Data Lightskyblue3, 13481613 Data Cyan3, 13487360 Data Grey71, 11908533 Data Chartreuse1, 65407 Data Deepskyblue2, 15643136 Data Steelblue2, 15641692 Data Chartreuse, 65407 Data Chartreuse, 65407 Data Wheat3, 9878221 Data Bisque3, 10401741 Data Plum3, 13473485 Data Darkgoldenrod1, 1030655 Data Darkturquoise, 13749760 Data Turquoise Dark, 13749760 Data Gold2, 51694 Data Lightsalmon1, 8036607 Data Seagreen2, 9760334 Data Lightsalmon, 8036607 Data Burlywood, 8894686 Data Burlywood, 8894686 Data Salmon Light, 8036607 Data Salmon Light, 8036607 Data Palevioletred1, 11240191 Data Slategray3, 13481631 Data Grey72, 12105912 Data Cadetblue3, 13485434 Data Lightsteelblue3, 13481378 Data Mediumturquoise, 13422920 Data Turquoise Medium, 13422920 Data Springgreen1, 8388352 Data Springgreen, 8388352 Data Green Early Spring, 8388352 Data Mediumpurple1, 16745131 Data Grey73, 12237498 Data Olivedrab2, 3862195 Data Goldenrod1, 2474495 Data Lightblue3, 13484186 Data Darkslategray3, 13487481 Data Lightpink2, 11379438 Data Mistyrose3, 11909069 Data Grey74, 12434877 Data Mediumspringgreen, 10156544 Data Green Spring, 10156544 Data Magenta1, 16711935 Data Magenta, 16711935 Data Grey, 12500670 Data Magenta, 16711935 Data Grey75, 12566463 Data Antiquewhite3, 11583693 Data Mediumorchid1, 16738016 Data Palegreen2, 9498256 Data Green Light, 9498256 Data Silver, 12632256 Data Paleturquoise3, 13487510 Data Lemonchiffon3, 10865101 Data Turquoise, 13688896 Data Turquoise, 13688896 Data Orchid2, 15301358 Data Greenyellow, 3145645 Data Green Yellow, 3145645 Data Grey76, 12763842 Data Darkolivegreen2, 6876860 Data Skyblue2, 15646846 Data Steelblue1, 16758883 Data Pink2, 12102126 Data Thistle3, 13481421 Data Deepskyblue1, 16760576 Data Deepskyblue, 16760576 Data Blue Sky Deep, 16760576 Data Cornsilk3, 11651277 Data Grey77, 12895428 Data Gold1, 55295 Data Seagreen1, 10485588 Data Plum, 14524637 Data Gold, 55295 Data Plum, 14524637 Data Gold, 55295 Data Burlywood2, 9553390 Data Lavenderblush3, 12960205 Data Seashell3, 12568013 Data Violet, 15631086 Data Violet, 15631086 Data Rosybrown2, 11842798 Data Lightyellow3, 11849165 Data Honeydew3, 12701121 Data Lightcyan3, 13487540 Data Grey78, 13092807 Data Lightsteelblue, 14599344 Data Blue Light Steel, 14599344 Data Olivedrab1, 4128704 Data Skyblue, 15453831 Data Blue Sky, 15453831 Data Grey79, 13224393 Data Yellow2, 61166 Data Aquamarine2, 13037174 Data Ivory3, 12701133 Data Azure3, 13487553 Data Snow3, 13224397 Data Palegreen, 10025880 Data Green Pale, 10025880 Data Lightpink1, 12168959 Data Grey80, 13421772 Data Lightgoldenrod2, 8576238 Data Navajowhite2, 10604526 Data Palegreen1, 10157978 Data Lightgoldenrod, 8576494 Data Turquoise2, 15656192 Data Thistle, 14204888 Data Thistle, 14204888 Data Peachpuff2, 11389934 Data Lightskyblue, 16436871 Data Blue Sky Light, 16436871 Data Grey81, 13619151 Data Orchid1, 16417791 Data Darkseagreen2, 11857588 Data Skyblue1, 16764551 Data Lightpink, 12695295 Data Pink Light, 12695295 Data Pink1, 12957183 Data Darkolivegreen1, 7405514 Data Lightskyblue2, 15651748 Data Grey82, 13750737 Data Khaki2, 8775406 Data Cyan2, 15658496 Data Lightblue, 15128749 Data Blue Light, 15128749 Data Burlywood1, 10212351 Data Lightgrey, 13882323 Data Gray Light, 13882323 Data Wheat2, 11458798 Data Khaki, 9234160 Data Khaki, 9234160 Data Grey83, 13948116 Data Plum2, 15642350 Data Rosybrown1, 12698111 Data Bisque2, 12047854 Data Slategray2, 15651769 Data Cadetblue2, 15656334 Data Lightsteelblue2, 15651516 Data Grey84, 14079702 Data Pink, 13353215 Data Powderblue, 15130800 Data Blue Powder, 15130800 Data Pink, 13353215 Data Aquamarine1, 13959039 Data Aquamarine, 13959039 Data Aquamarine, 13959039 Data Yellow1, 65535 Data Yellow, 65535 Data Yellow, 65535 Data Grey85, 14277081 Data Lightblue2, 15654834 Data Darkslategray2, 15658637 Data Wheat, 11788021 Data Wheat, 11788021 Data Palegoldenrod, 11200750 Data Goldenrod Pale, 11200750 Data Grey86, 14408667 Data Lightgoldenrod1, 9170175 Data Mistyrose2, 13817326 Data Turquoise1, 16774400 Data Navajowhite1, 11394815 Data Navajowhite, 11394815 Data Navajo White, 11394815 Data Gainsboro, 14474460 Data Gainsboro, 14474460 Data Peachpuff1, 12180223 Data Peachpuff, 12180223 Data Peach Puff, 12180223 Data Grey87, 14606046 Data Antiquewhite2, 13426670 Data Darkseagreen1, 12713921 Data Paleturquoise2, 15658670 Data Lightskyblue1, 16769712 Data Lemonchiffon2, 12577262 Data Paleturquoise, 15658671 Data Turquoise Pale, 15658671 Data Grey88, 14737632 Data Moccasin, 11920639 Data Moccasin, 11920639 Data Cyan1, 16776960 Data Cyan, 16776960 Data Cyan, 16776960 Data Khaki1, 9434879 Data Thistle2, 15651566 Data Cornsilk2, 13494510 Data Wheat1, 12249087 Data Grey89, 14935011 Data Plum1, 16759807 Data Bisque1, 12903679 Data Bisque, 12903679 Data Bisque, 12903679 Data Slategray1, 16769734 Data Cadetblue1, 16774552 Data Lightsteelblue1, 16769482 Data Grey90, 15066597 Data Lavenderblush2, 15065326 Data Seashell2, 14607854 Data Lightyellow2, 13758190 Data Honeydew2, 14741216 Data Lightcyan2, 15658705 Data Grey91, 15263976 Data Lightblue1, 16773055 Data Darkslategray1, 16777111 Data Blanchedalmond, 13495295 Data Blanched Almond, 13495295 Data Ivory2, 14741230 Data Antiquewhite, 14150650 Data White Antique, 14150650 Data Azure2, 15658720 Data Snow2, 15329774 Data Grey92, 15461355 Data Mistyrose1, 14804223 Data Mistyrose, 14804223 Data Misty Rose, 14804223 Data Lavender, 16443110 Data Lavender, 16443110 Data Papayawhip, 14020607 Data Papaya Whip, 14020607 Data Grey93, 15592941 Data Antiquewhite1, 14413823 Data Beige, 14480885 Data Beige, 14480885 Data Paleturquoise1, 16777147 Data Lightgoldenrodyellow, 13826810 Data Goldenrod Yellow, 13826810 Data Lemonchiffon1, 13499135 Data Lemonchiffon, 13499135 Data Lemon Chiffon, 13499135 Data Grey94, 15790320 Data Linen, 15134970 Data White Linen, 15134970 Data Grey95, 15921906 Data Thistle1, 16769535 Data Cornsilk1, 14481663 Data Cornsilk, 14481663 Data Cornsilk, 14481663 Data Oldlace, 15136253 Data White Old Lace, 15136253 Data Grey96, 16119285 Data Whitesmoke, 16119285 Data White Smoke, 16119285 Data Lavenderblush1, 16118015 Data Lavenderblush, 16118015 Data Lavender Blush, 16118015 Data Seashell1, 15660543 Data Seashell, 15660543 Data Seashell, 15660543 Data Lightyellow1, 14745599 Data Honeydew1, 15794160 Data Lightyellow, 14745599 Data Honeydew, 15794160 Data Honeydew, 15794160 Data Yellow Light, 14745599 Data Grey97, 16250871 Data Lightcyan1, 16777184 Data Lightcyan, 16777184 Data Cyan Light, 16777184 Data Aliceblue, 16775408 Data White Alice Blue, 16775408 Data Floralwhite, 15792895 Data White Floral, 15792895 Data Grey98, 16448250 Data Ghostwhite, 16775416 Data White Ghost, 16775416 Data Mintcream, 16449525 Data Mint Cream, 16449525 Data Azure1, 16777200 Data Ivory1, 15794175 Data Azure, 16777200 Data Ivory, 15794175 Data White Ivory, 15794175 Data Azure, 16777200 Data Snow1, 16448255 Data Snow, 16448255 Data Snow, 16448255 Data Grey99, 16579836 Data Grey99, 16777215 I think I need to investigate working with YUV instead of RGB to see if that 'simplifies' sorting..??...
__________________
Rgds, Dave |
|
#38
|
|||
|
|||
|
Dave, If your missus is anything like my missus (350 lbs of rompin stompin mean when irritated), therre really isn't any choice, is there?
Quote:
============================== "Hell is other people." Jean-Paul Sartre (1905-1980) ==============================
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml |
|
#39
|
|||
|
|||
|
I think I have finished with Color_Buttons, at least as far as features a (PB) programmer (at least this one, if I may be sp bold as to call myself one) would want (still awaiting Dave's color weighing algo for 'Function Weight_Colors' though {just kidding}).
The code is uploaded and the .exe is in Programs (see siggie below). I posted the code here so that any who may be reluctant to dl it for any reason, can see it here. If anyone has any suggestions for improvements or criticisms I'd appreciate hearing them. Then again maybe not but be that as it may ... Try the Spinner Buttons for Text Color. Kinda neat I think. ' Code:
'incorporating code from:
'http://www.powerbasic.com/support/pbforums/showthread.php?t=40672
'http://www.powerbasic.com/support/pbforums/newreply.php?do=newreply&p=316512
'
' ***************************************************************
' This code can be used Royalty Free and Freely Distributed !
' ***************************************************************
'
#Compile Exe
#Register None
#Dim All ' This is helpful to prevent errors in coding
#Debug Display On '<<<<<<<<<<<<<<< Remember to turn off for production code
'
#Include "win32api.inc" ' Must come first before other include files !
#Include "InitCtrl.inc" 'for spinners
'
Global g_hDlg_Highlight_Color, g_hDlg_bg_Color, g_CheckBox_Ids, g_Checkbox_Flag, g_Sort_Flag As Long
Global g_Sort_Btn_Ids, g_Start_Color_Btn_Ids_at As Long
'
' *******************************************************
' Spinner stuff
Global pnmud As nm_updown Ptr 'pointer to structure used by spinner
Global g_Textbox_BG_Color, g_Textbox_FG_Color As Long
Global g_Textbox_Name As String
%Id_Textbox_fg_Color_Spinner = 100
%Id_Textbox_Color = 101
%Id_Textbox_bg_Color_Spinner = 102
'%Id_Textbox_bg_Color_Spinner_Label = 103
'keep consistent style wherever spinners used
%spinner_style = %ws_child Or _
%ws_visible Or _
s_wrap Or _
s_arrowkeys
'
'
' *******************************************************
'
'
'this next included file needed for button colors can be found here:
'http://www.powerbasic.com/support/pbforums/showthread.php?t=38904
#Include "C:\Only_My_Programs\Include Files\ButtonPlus.bas"
'
' *******************************************************
'
Global g_Textbox_fg_Color_Flag, g_Textbox_bg_Color_Flag As Long ', g_Alt_Text_Color_Flag As Long
Type Colors_Array
Sort_by As String * 60 'way more than needed for sorting
Background_Color As Long
Display_Name As String * 30 'for display
Actual_Name As String * 30
Order As Long
Weight As Long
Text_Color As Long
End Type
Global ColorArray() As Colors_Array
'
Type Text_Colors
Color_Name As String * 10
Color_Value As Long
End Type
Global Text_Color() As Text_Colors
'
' *******************************************************
'
Sub Generate_Colors
aa_common_Locals
Local Num_Colors, Doing_Color As Long
Local Colr() As String 'name
Local Stps() As Long 'Steps in gradient range
Local Strt() As Long 'Color to start with
Local rr(), gg(), bb(), txChg() As Byte 'rgb starting colors
Local txt, tx1(), tx2() As Long 'text colors
'
ctr = 100 'Way more than needed
'by putting colors in arrays this way, makes it easy to change presentation order
Dim Colr(1 To ctr), Stps(1 To ctr), Strt(1 To ctr)
Dim rr(1 To ctr), gg(1 To ctr), bb(1 To ctr), tx1(1 To ctr), tx2(1 To ctr), txChg(1 To ctr)
Reset i
'Violet Indigo Blue Green Yellow Orange Red is rainbow
''Black = 1 for ButtonPlus
Incr i: Colr(i) = "Violet" : Stps(i) = 50: rr(i) = 255: gg(i) = 000: bb(i) = 255: tx1(i) = %White: tx2(i) = %Black: txChg(i) = 25 'Magenta
Incr i: Colr(i) = "Indigo" : Stps(i) = 50: rr(i) = 070: gg(i) = 000: bb(i) = 255: tx1(i) = %White: tx2(i) = %Black: txChg(i) = 30 'Blue
Incr i: Colr(i) = "Blue" : Stps(i) = 50: rr(i) = 000: gg(i) = 000: bb(i) = 255: tx1(i) = %White: tx2(i) = %Black: txChg(i) = 30 'Blue
Incr i: Colr(i) = "Green" : Stps(i) = 50: rr(i) = 000: gg(i) = 255: bb(i) = 000: tx1(i) = %Blue : tx2(i) = %Black: txChg(i) = 15 'Green
Incr i: Colr(i) = "Yellow" : Stps(i) = 45: rr(i) = 255: gg(i) = 255: bb(i) = 000: tx1(i) = %Green: tx2(i) = %Black: txChg(i) = 25 'Yellow
Incr i: Colr(i) = "Orange" : Stps(i) = 36: rr(i) = 255: gg(i) = 125: bb(i) = 000: tx1(i) = %White: tx2(i) = %Black: txChg(i) = 10 'Orange
Incr i: Colr(i) = "Red" : Stps(i) = 45: rr(i) = 255: gg(i) = 000: bb(i) = 000: tx1(i) = %White: tx2(i) = %Black: txChg(i) = 10 'Red
Incr i: Colr(i) = "Cyan" : Stps(i) = 50: rr(i) = 000: gg(i) = 255: bb(i) = 255: tx1(i) = %White: tx2(i) = %Black: txChg(i) = 5 'Cyan
Incr i: Colr(i) = "Black to Aquas" : Stps(i) = 50: rr(i) = 000: gg(i) = 000: bb(i) = 000: tx1(i) = %White: tx2(i) = %Black: txChg(i) = 33 'Black to Aquas
stp = 5
Num_Colors = i
Reset Num_Elements
For ctr = 1 To i
Num_Elements = Num_Elements + Stps(ctr)
Next ctr
Dim ColorArray(1 To Num_Elements) As Colors_Array
'
Reset i 'used above
While Doing_Color < Num_Colors
Incr Doing_Color
Reset i1
For ctr = 0 To 255 Step stp
If i = Num_Elements Then Exit For 'JIC array limit reached
Incr i1 'step counter
'
If i1 > Stps(Doing_Color) Then Exit For 'enough gradient
Incr i
l$ = Colr(Doing_Color)
If rr(Doing_Color) Then r = rr(Doing_Color) Else r = ctr
If gg(Doing_Color) Then g = gg(Doing_Color) Else g = ctr
If bb(Doing_Color) Then b = bb(Doing_Color) Else b = ctr
If i1 < txChg(Doing_Color) Then txt = tx1(Doing_Color) Else txt = tx2(Doing_Color)
'
GoSub Assign_it
Next ctr
Reset ctr1 'color range ctr for name
If i = Num_Elements Then GoTo Done 'JIC array limit reached
Wend
Done:
Exit Sub
'**************
Assign_it:
dv = RGB(r, g, b)
Incr ctr1
ColorArray(i).Order = i
ColorArray(i).Sort_by = Using$("#######", i)
ColorArray(i).Background_Color = dv
ColorArray(i).Text_Color = txt
ColorArray(i).Actual_Name = l$ & Using$("#########", ctr1)
ColorArray(i).Display_Name = _
Hex$(r, 2) & " " & Hex$(g, 2) & " " & Hex$(b, 2) & " - " & _
MCase$(l$) & Using$(" ### ", ctr1)
Return
End Sub
'
' *******************************************************
'Dave Biggs
Function Weight_Colors(Clor_Vlu As Long) As Long
Local iv, r, r1, r2, g, g1, g2, b, b1, b2, rmean As Long
Local h As String
iv = Color_Inverse(Clor_Vlu)
Function = iv - Clor_Vlu
'original
' r1 = GetRValue( %Color1) : r2 = GetRValue( %Color2)
' g1 = GetGValue( %Color1) : g2 = GetGValue( %Color2)
' b1 = GetBValue( %Color1) : b2 = GetBValue( %Color2)
' rmean = (r1 - r2)/2
' r = r1 - r2
' g = g1 - g2
' b = b1 - b2
' h$ = Hex$(Clor_Vlu)
' r = Val(Left$(h$, 2)) '
' g = Val(Mid$(h$, 3, 2))
' b = Val(Right$(h$, 2))
' rmean = r/2
'
' Function = Sqr(((2+rmean/256)*r*r) + 4*g*g + ((2+(255-rmean)/256)*b*b))
End Function
'
' *******************************************************
'
Function Btn_Set_Face_Color(ddlg As Dword, Id As Long, Btn_Color As Long) As Long
ButtonPlus ddlg, Id, %BP_FACE_BLEND, 255 'true color
ButtonPlus dDlg, Id, %BP_FACE_COLOR, Btn_Color ' &H008FDF8F
End Function
'
Function Btn_Set_Text_Color(ddlg As Dword, Id As Long, Btn_Color As Long) As Long
ButtonPlus dDlg, Id, %BP_Text_COLOR, Btn_Color ' &H008FDF8F
End Function
'
Macro AA_common_Locals 'prefix by AA puts at top of F4 (function list) - easy to find
Local nm, rx, gx, bx, hx, fn, l, l1, s1, s2, fle, s, t As String
Local fg, flag, fnt, bg, rh, bh, gh, ctr1, flen, fnum, ctr, i, i1, dv As Long
Local Num_Elements, stp, r, g, b As Long
Local Style&, ExStyle&
Local Testing_Flag, n1, clor, Id, Row, Col, N As Long
Local ht2, ht1, wd1, wd, ht, Max_ht, n2, Btn_Face_Color, Btn_Text_Color As Long
Local tmp$()
' Local i, clor, wd, ht, Id, n As Long
End Macro
''
Macro z_T_into_Tmp_Array 'send t$ returns tmp$()
ctr = ParseCount(t$, $CrLf)
Dim tmp$(ctr)
Parse t$, tmp$(), $CrLf
End Macro
'
Macro z_Binary_Get 'send fn$, returns flen, fle$
fnum = FreeFile
Open fn$ For Binary As fnum
flen = Lof(fnum)
Fle$ = Space$(flen)'create a space to put the file
Get fnum,,fle$ 'put the file in the space
Close fnum
End Macro
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'
' *******************************************************
'
' *************************************************************
' Application Globals Variables (#2)
' *************************************************************
'
Global hDlg& ' Dialog handle
Global hContainer&
'
' *************************************************************
' Application Entrance
' *************************************************************
'
Function PBMain
Local Count&
' Call z_Get_Colors_From_File
g_Sort_Flag = 6
g_Checkbox_Flag = 1
'
g_Sort_Btn_Ids = 1000
g_CheckBox_Ids = 1100
g_Start_Color_Btn_Ids_at = 2000
g_Textbox_fg_Color_Flag = 8
g_Textbox_bg_Color_Flag = 1 'first Color Button
'
ClipBoard Reset 'empty when starting
'
'
Call Generate_Colors
' Call Color_Array_Get
'
' Call Testing_File("C:\Temp\starting_Data.tst")
' Call z_New_Data_Set: Exit Function
'
PBMain_Display(0)
'
Do
Dialog DoEvents To Count&
Loop Until Count&=0
End Function
'
' *************************************************************
' Application Dialogs (#3)
' *************************************************************
'
'
Macro Color_Sort_Buttons
For Id = 1 To 10 'more than enough
If Id = g_Sort_Flag Then
clor = g_hDlg_Highlight_Color 'Gold
Else
clor = g_hDlg_bg_Color
End If
Btn_Set_Face_Color(hDlg, g_Sort_Btn_Ids + Id, Clor)
Control ReDraw hDlg, g_Sort_Btn_Ids + Id
Next Id
End Macro
'
Macro Color_Checkboxes
For Id = 1 To 10
If Id = g_Checkbox_Flag Then 'set in Callback which button to color
clor = g_hDlg_Highlight_Color 'Gold
Control Set Check hDlg, g_Checkbox_Ids + Id, 1
Else
clor = g_hDlg_bg_Color
Control Set Check hDlg, g_Checkbox_Ids + Id, 0
End If
Control Set Color hDlg, g_Checkbox_Ids + Id, -1, clor
Control ReDraw hDlg, g_CheckBox_Ids + Id
Next Id
End Macro
'
Function Add_Color_Buttons As Long
AA_common_Locals
PBMD_Fonts_Colors_Setup
'
wd = 130
ht = 12
Style = %BS_Center '%BS_Left 'easier to see sorts during testing than center
'
For N&= LBound(ColorArray()) To UBound(ColorArray())
Id = g_Start_Color_Btn_Ids_at + N
Control Kill hContainer&, Id 'case old buttons
Control Add Button, hContainer&, Id, _
Trim$(ColorArray(n).Display_Name), _
1, ((N&-1)*15)+2, _
wd, ht, _
Style, _
Call Button_SubClass_Processor
Control Set Font hContainer&, Id, hFont10
Clor = ColorArray(n).Background_Color
If Clor = 0 Then Clor = 1 'Black for ButtonPlus
Btn_Set_Face_Color(hContainer&, Id, Clor)
Clor = ColorArray(n).Text_Color
Btn_Set_Text_Color(hContainer, Id, Clor)
Next N&
End Function
'
Function Sort_Color_Array() As Long
AA_common_Locals
Testing_Flag = 0 'really doesn't work because Windows sends twice
If Testing_Flag = 1 Then
Dim tmp$(LBound(ColorArray()) To UBound(ColorArray()))
End If
For ctr = LBound(ColorArray()) To UBound(ColorArray())
If Testing_Flag = 1 Then tmp$(ctr) = ColorArray(ctr).Sort_by
'
n = RGB(ColorArray(ctr).Background_Color)'was bgr
hx$ = Hex$(n, 6)
rx$ = Left$(hx$, 2) '1st 2 bytes
bx$ = Mid$(hx$, 3, 2) 'Middle
gx$ = Right$(hx$, 2) 'Last 2
rh = Val("&h" & rx)
gh = Val("&h" & gx)
bh = Val("&h" & bx) 'hex value sort not good, want decimal value I think
'
Select Case g_Sort_Flag
Case 1 'RGB
ColorArray(ctr).Sort_by = hx$ '& " " & rx$ & bx$ & gx$
'
Case 2 'BGR
n1 = Bgr(n)
ColorArray(ctr).Sort_by = Hex$(n1, 6)
'
Case 3 'Name order
ColorArray(ctr).Sort_by = ColorArray(ctr).Actual_Name
'
Case 4 'Weight order
n1 = Weight_Colors(n) 'weighting function
ColorArray(ctr).Sort_by = Using$("#########", n1)
'
Case 5 'decimal value
ColorArray(ctr).Sort_by = Using$("#########", n)
'
Case 6 'original pre-sorted order
ColorArray(ctr).Sort_by = Using$("#########", ColorArray(ctr).Order)
'
Case Else
Exit Function
End Select
ColorArray(ctr).Sort_by = RTrim$(ColorArray(ctr).Sort_by) & " >>> " & ColorArray(ctr).Display_Name 'case of dup values
Next ctr
'
Array Sort ColorArray()
'
' Call Testing_File("C:\Temp\Data.tst")
End Function
'
Macro PBMD_Fonts_Colors_Setup
Local hfont12, hFont16, hFont10 As Dword
Font New "Comic Sans MS", 16 To hFont16
Font New "Comic Sans MS", 10 To hFont10
Font New "Comic Sans MS", 12 To hFont12
Dim Text_Color(1 To 99) As Text_Colors
Reset ctr
Incr ctr: Text_Color(ctr).Color_Name = "Black ":Text_Color(ctr).Color_Value = &H000000
Incr ctr: Text_Color(ctr).Color_Name = "Blue ":Text_Color(ctr).Color_Value = &HFF0000
Incr ctr: Text_Color(ctr).Color_Name = "Green ":Text_Color(ctr).Color_Value = &H00FF00
Incr ctr: Text_Color(ctr).Color_Name = "Cyan ":Text_Color(ctr).Color_Value = &HFFFF00
Incr ctr: Text_Color(ctr).Color_Name = "Red ":Text_Color(ctr).Color_Value = &H0000FF
Incr ctr: Text_Color(ctr).Color_Name = "Magenta ":Text_Color(ctr).Color_Value = &HFF00FF
Incr ctr: Text_Color(ctr).Color_Name = "Yellow ":Text_Color(ctr).Color_Value = &H00FFFF
Incr ctr: Text_Color(ctr).Color_Name = "White ":Text_Color(ctr).Color_Value = &HFFFFFF
Incr ctr: Text_Color(ctr).Color_Name = "Gray ":Text_Color(ctr).Color_Value = &H808080
Incr ctr: Text_Color(ctr).Color_Name = "LtGray ":Text_Color(ctr).Color_Value = &HC0C0C0
ReDim Preserve Text_Color(1 To ctr)
' g_Alt_Text_Color_Flag = 1
End Macro
'
Sub z_Testing_File(tf As String)' As Long
AA_common_Locals
Open tf$ For Output As #1
pf Space$(5);"Sort_by "; Space$(4); ">>> Name "; Space$(5); Time$;" " ; Date$; " ";
Select Case g_Sort_Flag
Case 1: pf "RGB Order"
Case 5: pf "BGR Order"
Case 2: pf "Name Order"
Case 3: pf "Weight Order"
Case 4: pf "Original Order"
Case 6: pf "Decimal Order"
End Select
'
For ctr = LBound(ColorArray()) To UBound(ColorArray())
pf Using$("### ", ctr); ColorArray(ctr).Sort_by; '_
'" --- "; ColorArray(ctr).Display_Name;
If ctr > 1 Then
' If ColorArray(ctr).Sort_by = ColorArray(ctr - 1).Sort_by Then
If ColorArray(ctr).Background_Color = ColorArray(ctr - 1).Background_Color Then
Incr ctr1 'count them
pf " Duplicate";
End If
End If
pf " " 'line feed
Next ctr
pf " "
pf , Using$("#, Duplicates", ctr1)
Close #1
End Sub
'
' *******************************************************
'
Function Text_Colors_Label_Update As Long
Local Id, clor, ub, lb As Long
'
ub = UBound(Text_Color())
lb = LBound(Text_Color())
If g_Textbox_fg_Color_Flag < lb Then g_Textbox_fg_Color_Flag = ub
If g_Textbox_fg_Color_Flag > ub Then g_Textbox_fg_Color_Flag = lb
'
ub = UBound(ColorArray())
lb = LBound(ColorArray())
If g_Textbox_bg_Color_Flag < lb Then g_Textbox_bg_Color_Flag = ub
If g_Textbox_bg_Color_Flag > ub Then g_Textbox_bg_Color_Flag = lb
'
g_Textbox_FG_Color = Text_Color(g_Textbox_fg_Color_Flag).Color_Value
g_Textbox_bg_Color = ColorArray(g_Textbox_bg_Color_Flag).Background_Color
Id = %Id_Textbox_Color
Control Set Color hdlg, Id, g_Textbox_FG_Color, g_Textbox_BG_Color
Control ReDraw hdlg, Id
End Function
'
Macro PBMD_Dialog_Create
Style& = %WS_POPUP Or %DS_MODALFRAME Or %WS_CAPTION Or %WS_MINIMIZEBOX Or %WS_SYSMENU Or %DS_CENTER
ExStyle& = 0
Wd = 265
Wd1 = wd - 20
ht = 400
ht2 = ht 'hold for later
Dialog New hParent&, Space$(12) & "Color Buttons v 0.0000000000002.5.9", _
0, 0, Wd, ht, Style&, ExStyle& To hDlg&
Dialog Set Color hdlg, %Black, g_hDlg_bg_Color
End Macro
'
Macro PBMD_Container_Create
wd = 135'Wd - 30'140
ht = ht - 20
Max_ht = 16 * UBound(ColorArray())'
'
hContainer& = x_CreateScrollContainer(hDlg&, 10, 20, wd, ht, Max_ht)
wd = 140
ht = 12
Dialog Set Color hContainer&, %Black, %White
End Macro
'
Macro PBMD_Exit_or_Resident
Row = Row + ht + 2
ht = 12
Ctr = 11: s$ = "Exit on Click": GoSub Add_Checkbox
Control Set Check hdlg, Id, 1 'default
Control Set Color hdlg, Id, -1, g_hDlg_Highlight_Color
Ctr = 12: s$ = "Stay Resident": GoSub Add_Checkbox
End Macro
'
Macro PBMD_Text_Spinners
Id = %Id_Textbox_fg_Color_Spinner
Control Add $updown_class, Hdlg, Id, "", col + wd - 1, row, wd, ht + 2, %spinner_style
Id = %Id_Textbox_bg_Color_Spinner
Control Add $updown_class, Hdlg, Id, "", col - 3 , row, wd, ht, %spinner_style
'
Control Add Label, hdlg, %Id_Textbox_Color, "Text Color", col + 8, Row, Wd - 8, ht + 2, %ss_center Or %SS_NOTIFY', Call PBMain_CB_Processor
Control Set Font hdlg, %Id_Textbox_Color, hfont12
g_Textbox_Name = "Standard"
g_Textbox_BG_Color = g_hDlg_bg_Color
g_Textbox_FG_Color = %Black
Control Set Color hdlg, %Id_Textbox_Color, g_Textbox_FG_Color, g_Textbox_BG_Color
Row = Row + 2 'extra size on tb's
End Macro
'
Macro PBMD_Color_to_Clipboard
Col = 10
Row = 1
ht1 = 16
fnt = hfont16
s$ = "Click Color to Clipboard and Exit"
Id = g_Start_Color_Btn_Ids_at
GoSub Add_Label
End Macro
'
Macro PBMD_Colors_Available
Row = 17
Col = Wd + 25 'beside container
Wd = 90
ht = 20
wd1 = wd
fnt = hfont16
s$ = Using$("#, Colors", UBound(ColorArray())): Id = g_CheckBox_Ids - 1:GoSub Add_Label
End Macro
'
Macro PBMD_Sort_Buttons 'processed in PBMain_CB_Processor
Row = Row + ht + 4
ht = 16
ctr = 7: s$ = "Use Textbox Colors": Btn_Face_Color = 3145645: GoSub Add_Option_Button
ctr = 1: s$ = "Sort by RGB": Btn_Face_Color = 3145645: GoSub Add_Option_Button
ctr = 2: s$ = "Sort by BGR": Btn_Face_Color = 8036607: GoSub Add_Option_Button
ctr = 3: s$ = "Sort by Name" : Btn_Face_Color = 12632256: GoSub Add_Option_Button
ctr = 4: s$ = "Sort by Weight": Btn_Face_Color = 8036607: GoSub Add_Option_Button
ctr = 5: s$ = "Sort by Decimal": Btn_Face_Color = 8036607: GoSub Add_Option_Button
ctr = 6: s$ = "Sort by Order": Btn_Face_Color = 8036607: GoSub Add_Option_Button
Color_Sort_Buttons
End Macro
'
Macro PBMD_ClipBoard
wd1 = wd
fnt = hfont12
s$ = "Put in Clipboard": Id = g_CheckBox_Ids - 2:GoSub Add_Label
Row = Row + ht + 4
ctr = 1: s$ = "Decimal Value": GoSub Add_Checkbox
Control Set Check hDlg, Id, 1 'default
ctr = 2: s$ = "Hex Value": GoSub Add_Checkbox
ctr = 3: s$ = "Name & Values": GoSub Add_Checkbox
ctr = 4: s$ = "Control Set Color": GoSub Add_Checkbox
ctr = 5: s$ = "Dialog Set Color": GoSub Add_Checkbox
ctr = 6: s$ = "Color=" & Chr$(34) & "Hex" & Chr$(34): GoSub Add_Checkbox
ctr = 10: s$ = ", Value (added)": GoSub Add_Checkbox
' Color="#9314FF"
Color_Checkboxes
End Macro
'
Sub PBMain_Display(ByVal hParent&)
AA_common_Locals
'PBMD_ = macros belonging to PBMain_Display (though may be used elsewhere) to reduce clutter
PBMD_Fonts_Colors_Setup
g_hDlg_bg_Color = 16766935
g_hDlg_Highlight_Color = 55295 'gold
'
PBMD_Dialog_Create
'
PBMD_Container_Create
'
PBMD_Color_to_Clipboard
'
Add_Color_Buttons'color buttons in container
'
PBMD_Colors_Available
'
PBMD_Exit_or_Resident
'
PBMd_Text_Spinners 'Textbox colors
'
PBMD_Sort_Buttons
'
' Row = Row + ht + 4
'
PBMD_ClipBoard
'
Dialog Show Modeless hContainer& , Call Container_CB_Processor
Dialog Show Modeless hDlg& , Call PBMain_CB_Processor
Exit Sub
'***********
Add_Label:
Control Add Label, hDlg, Id, s$, col, Row, wd1, ht1, %ss_Center
Control Set Font hDlg, Id, Fnt
Control Set Color hDlg, Id, -1, g_hDlg_bg_Color '&hcbc0ff
Return
'
Add_Checkbox:
Id = g_CheckBox_Ids + ctr
Control Add CheckBox, hDlg, Id, _
s$, _
Col, Row, _
Wd, ht, _
%SS_Center, _
Call PBMain_CB_Processor
Control Set Font hDlg, Id, hFont12
Control Set Color hDlg, Id, -1, g_hDlg_bg_Color
Row = Row + ht + 4
Return
'
Add_Option_Button:
Id = g_Sort_Btn_Ids + ctr
Control Add Button, hDlg, Id, _
s$, _
Col, Row, _
Wd, ht, _
%SS_Center, _
Call PBMain_CB_Processor
Control Set Font hDlg, Id, hFont12
Row = Row + ht + 4
Return
'
End Sub
' *************************************************************
' Dialog Callback Procedures
' *************************************************************
'
CallBack Function Container_CB_Processor
Select Case CB.Msg
Case Else
End Select
End Function
'
' ------------------------------------------------
CallBack Function Button_SubClass_Processor
aa_common_Locals
If CB.CtlMsg=%BN_CLICKED Then
Id = CB.Ctl - g_Start_Color_Btn_Ids_at
fg = ColorArray(Id).Background_Color
bg = ColorArray(Id).Text_Color
nm$ = Trim$(ColorArray(Id).Actual_Name) & " "
Select Case g_Checkbox_Flag
Case 1
s$ = Str$(bg)
Case 2
s$ = Hex$(bg, 6)
Case 3
s$ = nm$ & _
" fg = " & Str$(fg) & _
" bg = " & Str$(bg)
Case 4
s$ = "Control Set Color Dlg, Id, " & _
"&h" & Hex$(fg) & ", " & _
"&h" & Hex$(bg)
Case 5
s$ = "Dialog Set Color Dlg, " & _
"&h" & Hex$(fg) & ", " & _
"&h" & Hex$(bg)
Case 6
s$ = " Color=" & Chr$(34) & "#" & Hex$(bg, 6) & Chr$(34) & " "
Case 10
ClipBoard Get Text To s1$
s$ = s1$ & "," & Str$(bg)
' Exit_Flag_Unset
Incr flag 'don't exit
End Select
'color button clicked so set spinner bg
g_Textbox_Name = nm$
g_Textbox_BG_Color = bg
g_Textbox_BG_Color = fg
Control Set Text hdlg, %Id_Textbox_Color, nm$
Text_Colors_Label_Update '
ClipBoard Set Text s$
Control Get Check hdlg, g_Checkbox_Ids + 11 To i 'if 0 then resident checked so don't end
If flag = 0 And i = 1 Then Dialog End hDlg
End If
End Function
' ------------------------------------------------
'
'
Macro Update_Color_Button_Text_Colors
For ctr = LBound(ColorArray()) To UBound(ColorArray())
ColorArray(ctr).Text_Color = Text_Color(g_Textbox_fg_Color_Flag).Color_Value
Next ctr
End Macro
'
Macro Update_Container
Sort_Color_Array
Color_Sort_Buttons
Add_Color_Buttons
Dialog ReDraw hContainer
End Macro
'
Macro Exit_Box_Unset
Id = g_Checkbox_Ids + 11
Control Set Check hDlg, Id, 0 'unset set exit box
Control Set Color hDlg, Id, -1, g_hDlg_bg_Color
Control ReDraw hdlg, Id
Id = g_Checkbox_Ids + 12
Control Set Check hDlg, Id, 1 'unset set exit box
Control Set Color hDlg, Id, -1, g_hDlg_Highlight_Color
Control ReDraw hdlg, Id
End Macro
'
Macro Exit_Box_Set
Id = g_Checkbox_Ids + 11
Control Set Check hDlg, Id, 1 'set set exit box
Control Set Color hDlg, Id, -1, g_hDlg_Highlight_Color
Control ReDraw hdlg, Id
Id = g_Checkbox_Ids + 12
Control Set Check hDlg, Id, 0 'Unset resident box
Control Set Color hDlg, Id, -1, g_hDlg_Bg_Color
Control ReDraw hdlg, Id
End Macro
'
'*********
CallBack Function PBMain_CB_Processor
aa_common_locals
' Local Id, ctr, clor As Long
Static Last_Sort_Flag As Long
Select Case CB.Msg
Case %Wm_notify 'for spinners
Select Case CB.CtlMsg
Case %BN_CLICKED, %STN_CLICKED
pnmud = CB.lParam
Id = CB.Ctl
Select Case Id
Case %Id_Textbox_fg_Color_Spinner
If @pnmud.hdr.Code =
n_deltapos Then '+1 or -1
g_Textbox_fg_Color_Flag = g_Textbox_fg_Color_Flag + @pnmud.idelta
Text_Colors_Label_Update
Exit_Box_Unset
Control Set Color CB.Hndl, g_Checkbox_Ids + 12, -1, g_hDlg_Highlight_Color
End If
'
Case %Id_Textbox_bg_Color_Spinner
If @pnmud.hdr.Code =
n_deltapos Then '+1 or -1
g_Textbox_bg_Color_Flag = g_Textbox_bg_Color_Flag + @pnmud.idelta
Text_Colors_Label_Update
Exit_Box_Unset
Control Set Color CB.Hndl, g_Checkbox_Ids + 12, -1, g_hDlg_Highlight_Color
Id = g_Textbox_bg_Color_Flag
Control Set Text hdlg, %Id_Textbox_Color, ColorArray(Id).Actual_Name
End If
End Select
End Select
'
Case %WM_COMMAND 'This processes command messages
Select Case CB.Ctl - g_Sort_Btn_Ids
Last_Sort_Flag = g_Sort_Flag
Case 1, 2, 3, 4, 5, 6 'sort by
Select Case CB.CtlMsg
Case %BN_CLICKED
g_Sort_Flag = CB.Ctl - g_Sort_Btn_Ids
End Select
Update_Container
'
Case 7 'use textbox colors and exit
Select Case CB.CtlMsg
Case %BN_CLICKED
fg = g_Textbox_FG_Color
bg = g_Textbox_BG_Color
Select Case g_Checkbox_Flag
Case 1
s$ = Str$(fg) & ", " & Str$(bg)
Case 2
s$ = Hex$(fg, 6) & ", " & Hex$(bg)
Case 3
s$ = Trim$(g_Textbox_Name) & _
" fg = " & Str$(fg) & _
" bg = " & Str$(bg)
Case 4
s$ = "Control Set Color Dlg, Id, " & _
"&h" & Hex$(fg) & ", " & _
"&h" & Hex$(bg)
Case 5
s$ = "Dialog Set Color Dlg, " & _
"&h" & Hex$(fg) & ", " & _
"&h" & Hex$(bg)
Case 6
s$ = " Color=" & Chr$(34) & "#" & Hex$(fg, 6) & Chr$(34) & " "
Case 10
ClipBoard Get Text To s1$
s$ = s1$ & "," & Str$(bg)
End Select
ClipBoard Set Text s$
Dialog End hdlg
End Select
'
End Select
'
Select Case CB.Ctl - g_Checkbox_Ids
Id = CB.Ctl - g_Checkbox_Ids
Case 1 To 10
g_Checkbox_Flag = Id
Color_Checkboxes
'
Case 11 'Exit on choice
Control Get Check CB.Hndl, CB.Ctl To Flag
Select Case flag
Case 0: Exit_Box_Set
Case 1: Exit_Box_UnSet
End Select
Case 12 'stay resident
Control Get Check CB.Hndl, CB.Ctl To Flag
Select Case flag
Case 0: Exit_Box_UnSet
Case 1: Exit_Box_Set
End Select
'
End Select
'
Select Case CB.Ctl
Case %Id_Textbox_Color
If CB.CtlMsg = %STN_CLICKED Then Exit_Box_Unset
End Select
End Select
End Function
' ------------------------------------------------
'
Macro pf = Print #1,
'
Sub z_Get_Colors_From_File
AA_common_Locals
fn$ = CurDir$ & "\Color.inc"
z_Binary_Get 'send fn$, returns flen, fle$
t$ = fle$
z_T_into_Tmp_Array 'send t$ returns tmp$()
Close
Open "c:\Temp\Color.Data" For Output As #1
For ctr = LBound(tmp$()) To UBound(tmp$())
If InStr(tmp$(ctr), "=") = 0 Then Iterate For 'not line we want
t$ = tmp$(ctr) 'easier
i = InStr(t$, "%")
If i = 0 Then Iterate For 'bum line
t$ = Mid$(t$, i + 1) 'strip "%"
i = InStr(t$, " =")
If i = 0 Then Iterate For 'bum line
s$ = Left$(t$, i - 1) 'name
t$ = Mid$(t$, i + 3) 'get value
n = Val(t$) 'make decimal
pf "Data " & s$ & ", " & Str$(n)
Next ctr
? "done",, FuncName$
End Sub
' *************************************************************
' Scrollable Container
' *************************************************************
'
Function x_CreateScrollContainer(ByVal hParent&, ByVal X&, ByVal Y&, ByVal W&, ByVal H&, ByVal MaxH&) As Long
Local OffsetW&, OffsetH&, hCDlg&, hRealCDlg&
OffsetW&=(2*GetSystemMetrics(%SM_CXEDGE))+GetSystemMetrics(%SM_CXVSCROLL)
OffsetH&=(2*GetSystemMetrics(%SM_CXEDGE))
Dialog Pixels hParent&, OffsetW&, OffsetH& To Units OffsetW&, OffsetH&
Dialog New hParent&, "", X&, Y&, W&+OffsetW&, H&+OffsetH&, _
%WS_CHILD Or %WS_VSCROLL, %WS_EX_CLIENTEDGE Or %WS_EX_CONTROLPARENT To hCDlg&
Local S As SCROLLINFO
S.cbSize=(SizeOf(S))
S.fMask=%SIF_ALL
S.nPos=0
S.nPage= 15 * 24 '(ht * 25 shown ' set page skip value here
S.nMin=0
S.nMax=MaxH&-H&
SetScrollInfo(hCDlg&,%SB_VERT,S, %TRUE)
Dialog New hCDlg&, "", 0,0, W&, MaxH&, %WS_CHILD, %WS_EX_CONTROLPARENT To hRealCDlg&
Dialog Set Color hRealCDlg&, %Black, %White
' do dialog show in calling code
Dialog Show Modeless hCDlg& , Call Container_DLGPROC
Dialog Set User hCDlg&, 1, hRealCDlg& ' store child handle
Function=hRealCDlg&
End Function
'
CallBack Function Container_DLGPROC
Select Case CbMsg
Case %WM_VSCROLL
Local S As SCROLLINFO, OldPos&, NewPos&, hChildDlg&
S.cbSize=(SizeOf(S))
S.fMask=%SIF_ALL
OldPos&=GetScrollInfo(CbHndl,%SB_VERT,S)
OldPos&=S.nPos
Select Case LoWrd(CbWParam)
Case %SB_LINEDOWN
S.nPos=S.nPos+15
Case %SB_LINEUP
S.nPos=S.nPos-15
Case %SB_PAGEDOWN
S.nPos=S.nPos+S.nPage
Case %SB_PAGEUP
S.nPos=S.nPos-S.nPage
Case %SB_THUMBPOSITION
S.nPos=S.nTrackPos
Case %SB_THUMBTRACK
S.nPos=S.nTrackPos
Case Else
End Select
If S.nPos<S.nMin Then S.nPos=S.nMin
If S.nPos>S.nMax Then S.nPos=S.nMax
If S.nPos<>OldPos& Then
S.cbSize=(SizeOf(S))
S.fMask=%SIF_POS
S.nPos=S.nPos
NewPos&=SetScrollInfo(CbHndl,%SB_VERT,S, %TRUE)
NewPos&=-NewPos&
Dialog Get User CbHndl, 1 To hChildDlg&
Dialog Set Loc hChildDlg&, 0, NewPos&
End If
Case Else
End Select
End Function
'
' *******************************************************
'
' Get the inverse of a color by splitting it
' into r,g,b components and subtracting each from 255 (for text on labels)
Function Color_Inverse(hColor As Long) As Long
Local r,g,b As Byte
r=255-GetRValue(hColor)
g=255-GetGValue(hColor)
b=255-GetBValue(hColor)
Function=RGB(r,g,b) ' < MOD
''''''''''' End Function
''''''''''' '------------------/
''''''''''' 'DB code
''''''''''' ' Modifications for more consistantly readable text:
''''''''''' Local rh,gh,bh As Byte
''''''''''' Local rDiff, gDiff, bDiff As Byte
''''''''''' Local cBrightness, cDiff, cbDiff As Long
''''''''''' rh=GetRValue(hColor) : gh=GetGValue(hColor) : bh=GetBValue(hColor)
'''''''''''
''''''''''' ' calc color difference (between color and (inversed) text) > 500 is 'good' ?
''''''''''' rDiff = Max(r, rh) - Min(r, rh)
''''''''''' gDiff = Max(g, gh) - Min(g, gh)
''''''''''' bDiff = Max(b, bh) - Min(b, bh)
''''''''''' cDiff = rDiff + gDiff + bDiff
'''''''''''
''''''''''' cBrightness = (rh*299 + gh*587 + bh*114)/1000 ' brightness of the color
'''''''''''
''''''''''' ' calc color brightness difference (between text and color) > 125 is 'good' ?
''''''''''' cbDiff = Max((r*299 + g*587 + b*114)/1000, (rh*299 + gh*587 + bh*114)/1000) - _
''''''''''' Min((r*299 + g*587 + b*114)/1000, (rh*299 + gh*587 + bh*114)/1000)
'''''''''''
''''''''''' If cDiff > 500 And cbDiff > 125 Then ' in test list of 543 colors -
''''''''''' Function=RGB(r,g,b) ' ~ 139 inverse colors are 'ok'
''''''''''' ElseIf cBrightness > 125 Then
''''''''''' Function=RGB(0,0,0) ' ~ 241 better set to black
''''''''''' Else
''''''''''' Function=RGB(255,255,255) ' ~ 163 better set to white
''''''''''' End If
End Function ' < /MOD
'------------------/ColorInverse
'
' *******************************************************
'
'
================================ "Not a shred of evidence exists in favor of the idea that life is serious." Brenda Grill ================================
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml Last edited by Gösta H. Lovgren-2; Jun 12th, 2009 at 01:07 AM. |
|
#40
|
|||
|
|||
|
Hi Gösta,
Looks like some copy/paste gremlins snuck into the code for the Spinner stuff? The %spinner_style statement is broken as are the Code:
If @pnmud.hdr.Code = %udn_deltapos Then '+1 or -1 Here's a function which reorders the Data statements for the ColorArray based upon the 'ColourDifference' algorithm that I mentioned before. You're welcome to add it to your Color_Buttons program if you want. (Or just use it to help 'weed' the amalgamated color list of duplicates etc). Code:
'#DEBUG Display ON
#DIM ALL
#REGISTER NONE
#INCLUDE "WIN32API.INC"
TYPE Colors_Array
Sort_by AS STRING * 12
Value AS DWORD
COLOR AS STRING * 30
Order AS LONG
END TYPE
GLOBAL ColorArray() AS Colors_Array
GLOBAL SortedArray() AS Colors_Array
'------------------/
FUNCTION PBMAIN()
DIM sTest$, NumColors&
MakeColorArray(NumColors) ' 679 in current mixed up list
OrderByColorWeight(NumColors)
MSGBOX "Copy Data list from the file" + $CR + _
"'Sorted.txt' to Color_Buttons", , "Done!"
END FUNCTION
'------------------/PBMain
FUNCTION CalcDist(Color1 AS LONG, Color2 AS LONG) AS LONG
' Calculate 'ColorDistance' - Match = 0, Max diff = 756 (Black - White)
DIM r&, g&, b&, r1&, g1&, b1&, r2&, g2&, b2&, rmean&
r1 = GetRValue( Color1) : r2 = GetRValue( Color2)
g1 = GetGValue( Color1) : g2 = GetGValue( Color2)
b1 = GetBValue( Color1) : b2 = GetBValue( Color2)
rmean = (r1 + r2)/2
r = r1 - r2
g = g1 - g2
b = b1 - b2
FUNCTION = SQR(((2+rmean/256)*r*r) + 4*g*g + ((2+(255-rmean)/256)*b*b))
END FUNCTION
'------------------/CalcDist
SUB OrderByColorWeight(NumColors AS LONG)
DIM Color1&, Color2&, ColorDistance&, Test&, i&, o&, c&
DIM SortedArray(1 TO NumColors) AS Colors_array
DIM NewIndex&, Nearest&, NearestIndex&
Color1 = %BLACK ' %White ' %Red ' %Orange ' %Yellow ' %Green ' %Blue ' %RGB_Indigo ' %RGB_Violet '
NewIndex = 1
DO
Nearest = 800 ' Any ColorDistance should be < 756 !
FOR i = 1 TO UBOUND(ColorArray()) '
Color2 = ColorArray(i).Value ' Compute ColorDistance for each array color start with Black
IF Color2 <> -1 THEN ' Array member not yet copied to sorted array
ColorDistance = CalcDist(Color1, Color2) '
Test = MIN(ColorDistance, Nearest) ' Look for minimum ColorDistance on this pass
IF Test = ColorDistance THEN ' is it new - either closer or equal to previous
Nearest = ColorDistance : NearestIndex = i ' Nearest ~ closest color match so far - save array index
END IF
END IF
NEXT
' Copy Nearest to sorted array
SortedArray(NewIndex).COLOR = ColorArray(NearestIndex).COLOR
SortedArray(NewIndex).Value = ColorArray(NearestIndex).Value
INCR NewIndex
IF NewIndex > UBOUND(ColorArray()) THEN : WinBeep 800,1 : EXIT LOOP
ColorArray(NearestIndex).Value = -1 ' Don't want to 'find' this array member again!
Color1 = SortedArray(NewIndex-1).Value ' Start new search w/ Color1 = previous nearest match
LOOP
DIM sData$
OPEN "Sorted.txt" FOR OUTPUT AS #101 ' file for new Data statements
FOR c = 1 TO UBOUND (SortedArray())
sData = "Data " + EXTRACT$(SortedArray(c).COLOR, " ")
PRINT #101, sData ", " SortedArray(c).Value
NEXT
CLOSE # 101
END SUB
'------------------/OrderByColorWeight
SUB MakeColorArray(NumColors AS LONG)
DIM ctr&, sName$, sValue$, i&, dv&
NumColors = (DATACOUNT)\ 2
DIM ColorArray(1 TO NumColors) AS Colors_Array
FOR ctr = 1 TO DATACOUNT STEP 2 'read 2 items
INCR i
sName = READ$(ctr)
sValue = READ$(ctr + 1)
dv = VAL(sValue)
ColorArray(i).Order = ctr
ColorArray(i).Sort_by = USING$("#######", ctr)
ColorArray(i).Value = dv
ColorArray(i).COLOR = MCASE$(sName) '&" " & Hex$(dv, 6) & "h"
NEXT ctr
EXIT SUB:
'**********************
DATA BLACK, 0
DATA INDIAN RED, 6053069
DATA LIGHT CORAL, 8421616
DATA SALMON, 7504122
DATA SALMON DARK, 8034025
DATA SALMON LIGHT, 8036607
DATA CRIMSON, 3937500
DATA RED, 255
DATA Red FIRE BRICK, 2237106
DATA DARK RED, 139
DATA PINK, 13353215
DATA PINK LIGHT, 12695295
DATA PINK HOT, 11823615
DATA PINK DEEP, 9639167
DATA VIOLET RED Medium , 8721863
DATA VIOLET RED PALE, 9662683
DATA SALMON LIGHT, 8036607
DATA CORAL, 5275647
DATA TOMATO, 4678655
DATA ORANGE RED, 17919
DATA ORANGE DARK, 36095
DATA ORANGE, 42495
DATA GOLD, 55295
DATA YELLOW, 65535
DATA YELLOW LIGHT, 14745599
DATA LEMON CHIFFON, 13499135
DATA GOLDENROD YELLOW, 13826810
DATA PAPAYA WHIP, 14020607
DATA MOCCASIN, 11920639
DATA PEACH PUFF, 12180223
DATA GOLDENROD PALE, 11200750
DATA KHAKI, 9234160
DATA KHAKI DARK, 7059389
DATA LAVENDER, 16443110
DATA THISTLE, 14204888
DATA PLUM, 14524637
DATA VIOLET, 15631086
DATA ORCHID, 14053594
DATA MAGENTA, 16711935
DATA ORCHID MEDIUM, 13850042
DATA PURPLE MEDIUM, 14381203
DATA VIOLET BLUE, 14822282
DATA VIOLET DARK, 13828244
DATA ORCHID DARK, 13382297
DATA MAGENTA DARK, 9109643
DATA PURPLE, 8388736
DATA INDIGO, 8519755
DATA SLATE BLUE, 13458026
DATA SLATE BLUE DARK, 9125192
DATA SLATE BLUE MEDIUM, 15624315
DATA GREEN YELLOW, 3145645
DATA CHARTREUSE, 65407
DATA GREEN LAWN, 64636
DATA LIME, 65280
DATA LIME GREEN, 3329330
DATA GREEN PALE, 10025880
DATA GREEN LIGHT, 9498256
DATA GREEN SPRING, 10156544
DATA GREEN Early SPRING, 8388352
DATA GREEN Medium SEA, 7451452
DATA GREEN SEA, 5737262
DATA GREEN FOREST, 2263842
DATA GREEN, 32768
DATA GREEN DARK, 25600
DATA GREEN YELLOW, 3329434
DATA OLIVE DRAB, 2330219
DATA OLIVE, 32896
DATA OLIVE GREEN DARK, 3107669
DATA AQUAMARINE, 11193702
DATA GREEN SEA DARK, 9419919
DATA GREEN SEA LIGHT, 11186720
DATA DARK CYAN, 9145088
DATA TEAL, 8421376
DATA CYAN, 16776960
DATA CYAN LIGHT, 16777184
DATA TURQUOISE PALE, 15658671
DATA AQUAMARINE, 13959039
DATA TURQUOISE, 13688896
DATA TURQUOISE MEDIUM, 13422920
DATA TURQUOISE DARK, 13749760
DATA BLUE CADET, 10526303
DATA BLUE STEEL, 11829830
DATA BLUE LIGHT STEEL, 14599344
DATA BLUE POWDER, 15130800
DATA BLUE LIGHT, 15128749
DATA BLUE SKY, 15453831
DATA BLUE SKY LIGHT, 16436871
DATA BLUE Sky DEEP , 16760576
DATA BLUE DODGER, 16748574
DATA BLUE CORNFLOWER, 15570276
DATA BLUE MEDIUM SLATE, 15624315
DATA BLUE ROYAL, 14772545
DATA BLUE, 16711680
DATA BLUE MEDIUM, 13434880
DATA BLUE DARK, 9109504
DATA Blue NAVY, 8388608
DATA BLUE MIDNIGHT, 7346457
DATA CORNSILK, 14481663
DATA BLANCHED ALMOND, 13495295
DATA BISQUE, 12903679
DATA NAVAJO WHITE, 11394815
DATA WHEAT, 11788021
DATA BURLYWOOD, 8894686
DATA Tan, 9221330
DATA BROWN ROSY, 9408444
DATA BROWN SANDY, 6333684
DATA GOLDENROD, 2139610
DATA GOLDENROD DARK, 755384
DATA PERU, 4163021
DATA Brown CHOCOLATE, 1993170
DATA BROWN SADDLE, 1262987
DATA SIENNA, 2970272
DATA BROWN, 2763429
DATA MAROON, 128
DATA WHITE, 16777215
DATA SNOW, 16448255
DATA HONEYDEW, 15794160
DATA MINT CREAM, 16449525
DATA AZURE, 16777200
DATA White ALICE BLUE, 16775408
DATA WHITE GHOST, 16775416
DATA WHITE SMOKE, 16119285
DATA SEASHELL, 15660543
DATA BEIGE, 14480885
DATA WHITE OLD LACE, 15136253
DATA WHITE FLORAL, 15792895
DATA WHITE IVORY, 15794175
DATA WHITE ANTIQUE, 14150650
DATA WHITE LINEN, 15134970
DATA LAVENDER BLUSH, 16118015
DATA MISTY ROSE, 14804223
DATA GAINSBORO, 14474460
DATA GRAY LIGHT, 13882323
DATA SILVER, 12632256
DATA GRAY DARK, 11119017
DATA GRAY, 8421504
DATA "GRAY Dim", 6908265
DATA GRAY LIGHT SLATE, 10061943
DATA GRAY SLATE, 9470064
DATA GRAY DARK SLATE, 5197615
' new colors from here
DATA snow, 16448255
DATA ghostwhite, 16775416
DATA whitesmoke, 16119285
DATA gainsboro, 14474460
DATA floralwhite, 15792895
DATA oldlace, 15136253
DATA linen, 15134970
DATA antiquewhite, 14150650
DATA papayawhip, 14020607
DATA blanchedalmond, 13495295
DATA bisque, 12903679
DATA peachpuff, 12180223
DATA navajowhite, 11394815
DATA moccasin, 11920639
DATA cornsilk, 14481663
DATA ivory, 15794175
DATA lemonchiffon, 13499135
DATA seashell, 15660543
DATA honeydew, 15794160
DATA mintcream, 16449525
DATA azure, 16777200
DATA aliceblue, 16775408
DATA lavender, 16443110
DATA lavenderblush, 16118015
DATA mistyrose, 14804223
DATA White, 16777215
DATA darkslategrey, 5197615
DATA dimgrey, 6908265
DATA slategrey, 9470064
DATA lightslategrey, 10061943
DATA grey, 12500670
DATA lightgrey, 13882323
DATA midnightblue, 7346457
DATA navyblue, 8388608
DATA navy, 8388608
DATA cornflowerblue, 15570276
DATA darkslateblue, 9125192
DATA slateblue, 13458026
DATA mediumslateblue, 15624315
DATA lightslateblue, 16740484
DATA mediumblue, 13434880
DATA royalblue, 14772545
DATA Blue, 16711680
DATA dodgerblue, 16748574
DATA deepskyblue, 16760576
DATA skyblue, 15453831
DATA lightskyblue, 16436871
DATA steelblue, 11829830
DATA lightsteelblue, 14599344
DATA lightblue, 15128749
DATA powderblue, 15130800
DATA paleturquoise, 15658671
DATA darkturquoise, 13749760
DATA mediumturquoise, 13422920
DATA turquoise, 13688896
DATA Cyan, 16776960
DATA lightcyan, 16777184
DATA cadetblue, 10526303
DATA mediumaquamarine, 11193702
DATA aquamarine, 13959039
DATA darkgreen, 25600
DATA darkolivegreen, 3107669
DATA darkseagreen, 9419919
DATA seagreen, 5737262
DATA mediumseagreen, 7451452
DATA lightseagreen, 11186720
DATA palegreen, 10025880
DATA springgreen, 8388352
DATA lawngreen, 64636
DATA Green, 65280
DATA chartreuse, 65407
DATA mediumspringgreen, 10156544
DATA greenyellow, 3145645
DATA limegreen, 3329330
DATA yellowgreen, 3329434
DATA forestgreen, 2263842
DATA olivedrab, 2330219
DATA darkkhaki, 7059389
DATA khaki, 9234160
DATA palegoldenrod, 11200750
DATA lightgoldenrodyellow, 13826810
DATA lightyellow, 14745599
DATA Yellow, 65535
DATA gold, 55295
DATA lightgoldenrod, 8576494
DATA goldenrod, 2139610
DATA darkgoldenrod, 755384
DATA rosybrown, 9408444
DATA indianred, 6053069
DATA saddlebrown, 1262987
DATA sienna, 2970272
DATA peru, 4163021
DATA burlywood, 8894686
DATA beige, 14480885
DATA wheat, 11788021
DATA sandybrown, 6333684
DATA Tan, 9221330
DATA chocolate, 1993170
DATA firebrick, 2237106
DATA brown, 2763429
DATA darksalmon, 8034025
DATA salmon, 7504122
DATA lightsalmon, 8036607
DATA orange, 42495
DATA darkorange, 36095
DATA coral, 5275647
DATA lightcoral, 8421616
DATA tomato, 4678655
DATA orangered, 17919
DATA Red, 255
DATA hotpink, 11823615
DATA deeppink, 9639167
DATA pink, 13353215
DATA lightpink, 12695295
DATA palevioletred, 9662683
DATA maroon, 6303920
DATA mediumvioletred, 8721863
DATA violetred, 9445584
DATA Magenta, 16711935
DATA violet, 15631086
DATA plum, 14524637
DATA orchid, 14053594
DATA mediumorchid, 13850042
DATA darkorchid, 13382297
DATA darkviolet, 13828244
DATA blueviolet, 14822282
DATA purple, 15736992
DATA mediumpurple, 14381203
DATA thistle, 14204888
DATA snow1, 16448255
DATA snow2, 15329774
DATA snow3, 13224397
DATA snow4, 9013643
DATA seashell1, 15660543
DATA seashell2, 14607854
DATA seashell3, 12568013
DATA seashell4, 8554123
DATA antiquewhite1, 14413823
DATA antiquewhite2, 13426670
DATA antiquewhite3, 11583693
DATA antiquewhite4, 7897995
DATA bisque1, 12903679
DATA bisque2, 12047854
DATA bisque3, 10401741
DATA bisque4, 7044491
DATA peachpuff1, 12180223
DATA peachpuff2, 11389934
DATA peachpuff3, 9809869
DATA peachpuff4, 6649739
DATA navajowhite1, 11394815
DATA navajowhite2, 10604526
DATA navajowhite3, 9155533
DATA navajowhite4, 6191499
DATA lemonchiffon1, 13499135
DATA lemonchiffon2, 12577262
DATA lemonchiffon3, 10865101
DATA lemonchiffon4, 7375243
DATA cornsilk1, 14481663
DATA cornsilk2, 13494510
DATA cornsilk3, 11651277
DATA cornsilk4, 7899275
DATA ivory1, 15794175
DATA ivory2, 14741230
DATA ivory3, 12701133
DATA ivory4, 8620939
DATA honeydew1, 15794160
DATA honeydew2, 14741216
DATA honeydew3, 12701121
DATA honeydew4, 8620931
DATA lavenderblush1, 16118015
DATA lavenderblush2, 15065326
DATA lavenderblush3, 12960205
DATA lavenderblush4, 8815499
DATA mistyrose1, 14804223
DATA mistyrose2, 13817326
DATA mistyrose3, 11909069
DATA mistyrose4, 8093067
DATA azure1, 16777200
DATA azure2, 15658720
DATA azure3, 13487553
DATA azure4, 9145219
DATA slateblue1, 16740227
DATA slateblue2, 15624058
DATA slateblue3, 13457769
DATA slateblue4, 9124935
DATA royalblue1, 16741960
DATA royalblue2, 15625795
DATA royalblue3, 13459258
DATA royalblue4, 9125927
DATA blue1, 16711680
DATA blue2, 15597568
DATA blue3, 13434880
DATA blue4, 9109504
DATA dodgerblue1, 16748574
DATA dodgerblue2, 15631900
DATA dodgerblue3, 13464600
DATA dodgerblue4, 9129488
DATA steelblue1, 16758883
DATA steelblue2, 15641692
DATA steelblue3, 13472847
DATA steelblue4, 9135158
DATA deepskyblue1, 16760576
DATA deepskyblue2, 15643136
DATA deepskyblue3, 13474304
DATA deepskyblue4, 9136128
DATA skyblue1, 16764551
DATA skyblue2, 15646846
DATA skyblue3, 13477484
DATA skyblue4, 9138250
DATA lightskyblue1, 16769712
DATA lightskyblue2, 15651748
DATA lightskyblue3, 13481613
DATA lightskyblue4, 9141088
DATA slategray1, 16769734
DATA slategray2, 15651769
DATA slategray3, 13481631
DATA slategray4, 9141100
DATA lightsteelblue1, 16769482
DATA lightsteelblue2, 15651516
DATA lightsteelblue3, 13481378
DATA lightsteelblue4, 9141102
DATA lightblue1, 16773055
DATA lightblue2, 15654834
DATA lightblue3, 13484186
DATA lightblue4, 9143144
DATA lightcyan1, 16777184
DATA lightcyan2, 15658705
DATA lightcyan3, 13487540
DATA lightcyan4, 9145210
DATA paleturquoise1, 16777147
DATA paleturquoise2, 15658670
DATA paleturquoise3, 13487510
DATA paleturquoise4, 9145190
DATA cadetblue1, 16774552
DATA cadetblue2, 15656334
DATA cadetblue3, 13485434
DATA cadetblue4, 9143891
DATA turquoise1, 16774400
DATA turquoise2, 15656192
DATA turquoise3, 13485312
DATA turquoise4, 9143808
DATA cyan1, 16776960
DATA cyan2, 15658496
DATA cyan3, 13487360
DATA cyan4, 9145088
DATA darkslategray1, 16777111
DATA darkslategray2, 15658637
DATA darkslategray3, 13487481
DATA darkslategray4, 9145170
DATA aquamarine1, 13959039
DATA aquamarine2, 13037174
DATA aquamarine3, 11193702
DATA aquamarine4, 7637829
DATA darkseagreen1, 12713921
DATA darkseagreen2, 11857588
DATA darkseagreen3, 10210715
DATA darkseagreen4, 6916969
DATA seagreen1, 10485588
DATA seagreen2, 9760334
DATA seagreen3, 8441155
DATA seagreen4, 5737262
DATA palegreen1, 10157978
DATA palegreen2, 9498256
DATA palegreen3, 8179068
DATA palegreen4, 5540692
DATA springgreen1, 8388352
DATA springgreen2, 7794176
DATA springgreen3, 6737152
DATA springgreen4, 4557568
DATA green1, 65280
DATA green2, 60928
DATA green3, 52480
DATA green4, 35584
DATA chartreuse1, 65407
DATA chartreuse2, 61046
DATA chartreuse3, 52582
DATA chartreuse4, 35653
DATA olivedrab1, 4128704
DATA olivedrab2, 3862195
DATA olivedrab3, 3329434
DATA olivedrab4, 2263913
DATA darkolivegreen1, 7405514
DATA darkolivegreen2, 6876860
DATA darkolivegreen3, 5950882
DATA darkolivegreen4, 4033390
DATA khaki1, 9434879
DATA khaki2, 8775406
DATA khaki3, 7587533
DATA khaki4, 5146251
DATA lightgoldenrod1, 9170175
DATA lightgoldenrod2, 8576238
DATA lightgoldenrod3, 7388877
DATA lightgoldenrod4, 5013899
DATA lightyellow1, 14745599
DATA lightyellow2, 13758190
DATA lightyellow3, 11849165
DATA lightyellow4, 8031115
DATA yellow1, 65535
DATA yellow2, 61166
DATA yellow3, 52685
DATA yellow4, 35723
DATA gold1, 55295
DATA gold2, 51694
DATA gold3, 44493
DATA gold4, 30091
DATA goldenrod1, 2474495
DATA goldenrod2, 2274542
DATA goldenrod3, 1940429
DATA goldenrod4, 1337739
DATA darkgoldenrod1, 1030655
DATA darkgoldenrod2, 962030
DATA darkgoldenrod3, 824781
DATA darkgoldenrod4, 550283
DATA rosybrown1, 12698111
DATA rosybrown2, 11842798
DATA rosybrown3, 10197965
DATA rosybrown4, 6908299
DATA indianred1, 6974207
DATA indianred2, 6513646
DATA indianred3, 5592525
DATA indianred4, 3816075
DATA sienna1, 4686591
DATA sienna2, 4356590
DATA sienna3, 3762381
DATA sienna4, 2508683
DATA burlywood1, 10212351
DATA burlywood2, 9553390
DATA burlywood3, 8235725
DATA burlywood4, 5600139
DATA wheat1, 12249087
DATA wheat2, 11458798
DATA wheat3, 9878221
DATA wheat4, 6717067
DATA tan1, 5219839
DATA tan2, 4823790
DATA tan3, 4163021
DATA tan4, 2841227
DATA chocolate1, 2392063
DATA chocolate2, 2193134
DATA chocolate3, 1926861
DATA chocolate4, 1262987
DATA firebrick1, 3158271
DATA firebrick2, 2895086
DATA firebrick3, 2500301
DATA firebrick4, 1710731
DATA brown1, 4210943
DATA brown2, 3881966
DATA brown3, 3355597
DATA brown4, 2302859
DATA salmon1, 6917375
DATA salmon2, 6456046
DATA salmon3, 5533901
DATA salmon4, 3755147
DATA lightsalmon1, 8036607
DATA lightsalmon2, 7509486
DATA lightsalmon3, 6455757
DATA lightsalmon4, 4347787
DATA orange1, 42495
DATA orange2, 39662
DATA orange3, 34253
DATA orange4, 23179
DATA darkorange1, 32767
DATA darkorange2, 30446
DATA darkorange3, 26317
DATA darkorange4, 17803
DATA coral1, 5665535
DATA coral2, 5270254
DATA coral3, 4545485
DATA coral4, 3096203
DATA tomato1, 4678655
DATA tomato2, 4349166
DATA tomato3, 3755981
DATA tomato4, 2504331
DATA orangered1, 17919
DATA orangered2, 16622
DATA orangered3, 14285
DATA orangered4, 9611
DATA red1, 255
DATA red2, 238
DATA red3, 205
DATA deeppink1, 9639167
DATA deeppink2, 8983278
DATA deeppink3, 7737549
DATA deeppink4, 5245579
DATA hotpink1, 11824895
DATA hotpink2, 10971886
DATA hotpink3, 9461965
DATA hotpink4, 6437515
DATA pink1, 12957183
DATA pink2, 12102126
DATA pink3, 10392013
DATA pink4, 7103371
DATA lightpink1, 12168959
DATA lightpink2, 11379438
DATA lightpink3, 9800909
DATA lightpink4, 6643595
DATA palevioletred1, 11240191
DATA palevioletred2, 10451438
DATA palevioletred3, 9005261
DATA palevioletred4, 6113163
DATA maroon1, 11744511
DATA maroon2, 10957038
DATA maroon3, 9447885
DATA maroon4, 6429835
DATA violetred1, 9846527
DATA violetred2, 9190126
DATA violetred3, 7877325
DATA violetred4, 5382795
DATA magenta1, 16711935
DATA magenta2, 15597806
DATA magenta3, 13435085
DATA magenta4, 9109643
DATA orchid1, 16417791
DATA orchid2, 15301358
DATA orchid3, 13199821
DATA orchid4, 8996747
DATA plum1, 16759807
DATA plum2, 15642350
DATA plum3, 13473485
DATA plum4, 9135755
DATA mediumorchid1, 16738016
DATA mediumorchid2, 15622097
DATA mediumorchid3, 13456052
DATA mediumorchid4, 9123706
DATA darkorchid1, 16727743
DATA darkorchid2, 15612594
DATA darkorchid3, 13447834
DATA darkorchid4, 9118312
DATA purple1, 16724123
DATA purple2, 15608977
DATA purple3, 13444733
DATA purple4, 9116245
DATA mediumpurple1, 16745131
DATA mediumpurple2, 15628703
DATA mediumpurple3, 13461641
DATA mediumpurple4, 9127773
DATA thistle1, 16769535
DATA thistle2, 15651566
DATA thistle3, 13481421
DATA thistle4, 9141131
DATA grey1, 197379
DATA grey2, 328965
DATA grey3, 526344
DATA grey4, 657930
DATA grey5, 855309
DATA grey6, 986895
DATA grey7, 1184274
DATA grey8, 1315860
DATA grey9, 1513239
DATA grey10, 1710618
DATA grey11, 1842204
DATA grey12, 2039583
DATA grey13, 2171169
DATA grey14, 2368548
DATA grey15, 2500134
DATA grey16, 2697513
DATA grey17, 2829099
DATA grey18, 3026478
DATA grey19, 3158064
DATA grey20, 3355443
DATA grey21, 3552822
DATA grey22, 3684408
DATA grey23, 3881787
DATA grey24, 4013373
DATA grey25, 4210752
DATA grey26, 4342338
DATA grey27, 4539717
DATA grey28, 4671303
DATA grey29, 4868682
DATA grey30, 5066061
DATA grey31, 5197647
DATA grey32, 5395026
DATA grey33, 5526612
DATA grey34, 5723991
DATA grey35, 5855577
DATA grey36, 6052956
DATA grey37, 6184542
DATA grey38, 6381921
DATA grey39, 6513507
DATA grey40, 6710886
DATA grey41, 6908265
DATA grey42, 7039851
DATA grey43, 7237230
DATA grey44, 7368816
DATA grey45, 7566195
DATA grey46, 7697781
DATA grey47, 7895160
DATA grey48, 8026746
DATA grey49, 8224125
DATA grey50, 8355711
DATA grey51, 8553090
DATA grey52, 8750469
DATA grey53, 8882055
DATA grey54, 9079434
DATA grey55, 9211020
DATA grey56, 9408399
DATA grey57, 9539985
DATA grey58, 9737364
DATA grey59, 9868950
DATA grey60, 10066329
DATA grey61, 10263708
DATA grey62, 10395294
DATA grey63, 10592673
DATA grey64, 10724259
DATA grey65, 10921638
DATA grey66, 11053224
DATA grey67, 11250603
DATA grey68, 11382189
DATA grey69, 11579568
DATA grey70, 11776947
DATA grey71, 11908533
DATA grey72, 12105912
DATA grey73, 12237498
DATA grey74, 12434877
DATA grey75, 12566463
DATA grey76, 12763842
DATA grey77, 12895428
DATA grey78, 13092807
DATA grey79, 13224393
DATA grey80, 13421772
DATA grey81, 13619151
DATA grey82, 13750737
DATA grey83, 13948116
DATA grey84, 14079702
DATA grey85, 14277081
DATA grey86, 14408667
DATA grey87, 14606046
DATA grey88, 14737632
DATA grey89, 14935011
DATA grey90, 15066597
DATA grey91, 15263976
DATA grey92, 15461355
DATA grey93, 15592941
DATA grey94, 15790320
DATA grey95, 15921906
DATA grey96, 16119285
DATA grey97, 16250871
DATA grey98, 16448250
DATA grey99, 16579836
END SUB 'Black 000001h 1
__________________
Rgds, Dave |
|
#41
|
|||
|
|||
|
Quote:
Quote:
Notes - As you'll see if you run the attached code (or the Exe from the link in the sig below), I've added a couple options. Display Hex or Decimal values, for example. Also Color_Buttons no longer uses DATA of %Colors but generates its own according to the Rainbow (VIBGYOR) and a few more. Very easy to a programmers to add more or delete any. (See Sub Generate_Colors) Also I've changed quite a few variable names to more use related one (had way too many with "color" in them, was just creating even more confusion for me). Also the spinner on the left of the container (%Id_Color_Array_Spinner in PBMain_CB_Processor) doesn't do anything just yet. Am intending some quick jumps for displaying the colors but haven't got it worked out yet. Up to nearly 3am last night playing around but ... Thx your efforts Dave. Really appreciated here. Looking forward to anything more you can add. ======================================== Admiration is the daughter of ignorance. Ben Franklin ======================================== {Just popped, I promise. No irony intended {laughing})
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml |
|
#42
|
|||
|
|||
|
Quote:
Code:
'%Id_Textbox_bg_Color_Spinner_Label = 103
'keep consistent style wherever spinners used
%spinner_style = %ws_child Or _
%ws_visible Or _
s_wrap Or _
s_arrowkeys
}No promises for more code soon but I rekon it should be do-able to convert the RGB values in an 'unordered' list to HSV and then sort the array by HUE to get a list that is grouped by actual color..Thanks for posting your super cool stuff here Gösta! Much admiration prompting me to resolve my ignorance
__________________
Rgds, Dave |
|
#43
|
|||
|
|||
|
Dave & Gosta (I tried spelling your name properly, Gosta, but something weird happened when I tried the ALT-xxx),
I've been following this thread with interest. I am most definitely not an 'artist', but something that *might* help you fellows out is using your color definitions in the HSL (hue-saturation-luminance) way. The HSL methods are different than the RGB methods. Both methods have their uses, and I use both methods according to what I think is best for the jobs in my DLL's. Anyway, I know both Mark Hunter and I had posted HSL-related code in the Source Code Forum a long time ago. If I still had it, I would post the website where I found the RGB-to-HSL and HSL-to-RGB conversion codes. The codes are easy-to-follow and easy to port to PB. If you're interested in the code, let me know and I'll post it. I'm talking about after I had ported it over to PB. If you fellows do a search in the Source Code Forum for my name, you should find some color-management code. I *believe* some of it used HSL and some of it used RGB. Good luck!
|
|
#44
|
|||
|
|||
|
__________________
Dave. The older we get, the fewer things seem worth waiting in line for. |
|
#45
|
|||
|
|||
|
Quote:
If you look at the slide bars for H S & B in Absolute Color Picker you can see the RGB colors change (or not) as the bar moves. The S bar seems to be the one I want really. Color just pales, but doesn''t seem to change. It looks to be a simple formula but am too tired tonight to play with it. [quote] Quote:
Quote:
Code:
'**************
Assign_it:
Incr ctr1
dv = RGB(r, g, b)
l$ = MCase$(l$) & Using$(" ##", ctr1)
'******
If i1 < txChg(Doing_Color) Then Txt_Color = tx1(Doing_Color) Else Txt_Color = tx2(Doing_Color)
'Txt_Color = (Abs(dv - &hFFFFFF)) 'not good
'Txt_Color = RGB(Abs(r - 255), g, Abs(b - 255)) 'opposite? - not so hot anyway
'Txt_Color = RGB( ((R& + 128) Mod 256), ((G& + 128) Mod 256), ((B& + 128) Mod 256) ) 'Not good contrast
'Txt_Color = RGB((Abs(r-255)), (Abs(g-255)), (Abs(g-255)))'contrast goes from good(?) to invisible back to good(?)
'Txt_Color = RGB_to_HSL(r, g, b) 'Contrast mostly poor 'Rtns Hue, Luminescence and Saturation
ColorArray(i).Order = i
ColorArray(i).Sort_by = Using$("#######", i)
ColorArray(i).Background_Color = dv
ColorArray(i).Text_Color = Txt_Color
ColorArray(i).Actual_Name = l$
ColorArray(i).Decimal_Name = Using$("###,###,### ", dv) & l$
ColorArray(i).Display_Name = _
Hex$(r, 2) & " " & Hex$(g, 2) & " " & Hex$(b, 2) & " - " & _
l$
ColorArray(i).Hex_Name = ColorArray(i).Display_Name
ColorArray(i).Weight = RGB_to_HSL(r, g, b)
Return
__________________
It's a pretty day. I hope you enjoy it. Gösta Easy Tape (It All Adds UP): http://www.swedesdock.com/easytape My Ego Site: http://www.SwedesDock.com PB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.html JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking Free PB Programs: http://www.swedesdock.com/powerbasic/Programs.shtml |
![]() |
| Tags |
| color button chooser, color buttons |
| Thread Tools | |
| Display Modes | |
|
|