Code: Select all
;*****************************************************************************
;*
;* XMas 2014 PurePunch contest
;* PureBasic 5.31
;* 64 lines of 80 chars of code + 128 lines of data
;*
;* Name : XMASColors.pb
;* Author : Enrico 'es_91' Seidel
;* Date : 12/04/14
;* Notes : Sorry about the (missing) style!
;*
;*****************************************************************************
DataSection
Names:
Data$"Aero","AeroBlue","AfricanViolet","AirSuperiorityBlue","AliceBlue"
Data$"Almond","AmaranthPink","AntiFlashWhite","AntiqueBrass","AntiqueWhite"
Data$"Apricot","Aqua","Aquamarine","ArylideYellow","AshGrey","AtomicTangerine"
Data$"Aureolin","Azure_WebColor","AzureMist","AzureishWhite","BabyBlue"
Data$"BabyBlueEyes","BabyPink","BabyPowder","BakerMillerPink","BananaMania"
Data$"BananaYellow","BeauBlue","Beige","Bisque","BlanchedAlmond","BlizzardBlue"
Data$"Blond","BlueBell","Bone","BrightLavender","BrightLilac","BrightUbe"
Data$"BrilliantLavender","BrilliantRose","BrinkPink","BubbleGum","Bubbles"
Data$"Buff","Burlywood","CadetGrey","CadmiumYellow","CambridgeBlue","CameoPink"
Data$"CanaryYellow","CarnationPink","Ceil","Celadon","Celeste","Champagne"
Data$"CharmPink","Chartreuse_Traditional","CherryBlossomPink","ChinaPink"
Data$"ClassicRose","ColumbiaBlue","CongoPink","CoralPink","Corn"
Data$"CornflowerBlue","Cornsilk","CosmicLatte","CottonCandy","Cream","Cyan"
Data$"CyberYellow","Daffodil","Dandelion","DarkGray_X11","DarkImperialBlue_"
Data$"DarkKhaki","DarkMediumGray","DarkPastelBlue","DarkPastelPurple"
Data$"DarkSalmon","DarkSeaGreen","DarkSkyBlue","DarkVanilla","DeepChampagne"
Data$"DeepFuchsia","DeepLemon","DeepMauve","DeepPeach","DesertSand","Diamond"
Data$"DustStorm","DutchWhite","EarthYellow","Ecru","Eggshell","ElectricBlue"
Data$"ElectricCyan","ElectricLavender","ElectricYellow","EtonBlue","Fawn"
Data$"Feldspar","FlamingoPink","Flavescent","Flax","FloralWhite","FrenchLime"
Data$"FrenchMauve","FrenchPink","FrenchSkyBlue","FreshAir","Fuchsia"
Data$"Fuchsia_Crayola","FuchsiaPink","Gainsboro","GhostWhite","Glitter"
Data$"Gold_Web_Golden","GoldenYellow","GrannySmithApple","Gray_X11Gray"
Data$"GreenYellow","HansaYellow","Heliotrope","HeliotropeGray","Honeydew"
Data$"HotMagenta","HotPink","Iceberg","Icterine","Inchworm","IndianYellow"
Data$"Isabelline","ItalianSkyBlue","Ivory","Jasmine","Jonquil","JordyBlue"
Data$"JuneBud","Jawad_ChickenColor_HTML_CSS_Khaki","Khaki_X11_LightKhaki"
Data$"Kobi","LanguidLavender","LaserLemon","LaurelGreen","Lavender_Floral"
Data$"Lavender_Web","LavenderBlue","LavenderBlush","LavenderGray"
Data$"LavenderIndigo","LavenderMagenta","LavenderMist","LavenderPink"
Data$"LavenderRose","Lemon","LemonChiffon","LemonGlacier","LemonLime"
Data$"LemonMeringue","LemonYellow","Lenurple","LightApricot","LightBlue"
Data$"LightCobaltBlue","LightCoral","LightCornflowerBlue","LightCrimson"
Data$"LightCyan","LightDeepPink","LightFrenchBeige","LightFuchsiaPink"
Data$"LightGoldenrodYellow","LightGray","LightGrayishMagenta","LightGreen"
Data$"LightHotPink","LightKhaki","LightMediumOrchid","LightMossGreen"
Data$"LightOrchid","LightPastelPurple","LightPink","LightSalmon"
Data$"LightSalmonPink","LightSkyBlue","LightSteelBlue","LightThulianPink"
Data$"LightYellow","Lilac","Linen","LiseranPurple","LittleBoyBlue","Lumber"
Data$"Magenta","Magenta_Crayola","MagicMint","Magnolia","Maize","Manatee"
Data$"Mauve","Mauvelous","MayaBlue","MeatBrown","MediumAquamarine"
Data$"MediumChampagne","MediumLavenderMagenta","MediumOrchid","MediumPurple"
Data$"MediumSkyBlue","MediumSlateBlue","MediumSpringBud","MediumTurquoise"
Data$"MellowApricot","MellowYellow","Melon","Mindaro","MintCream","MintGreen"
Data$"MistyRose","Moccasin","MoonstoneBlue","Mustard","NadeshikoPink"
Data$"NaplesYellow","NavajoWhite","NavyPurple","NeonCarrot","NewYorkPink"
Data$"NonPhotoBlue","Nyanza","OldLace","OperaMauve","Orchid","OrchidPink"
Data$"PaleAqua","PaleBlue","PaleCerulean","PaleChestnut","PaleCornflowerBlue"
Data$"PaleCyan","PaleGold","PaleGoldenrod","PaleGreen","PaleLavender"
Data$"PaleMagenta","PaleMagentaPink","PalePink","PalePlum","PaleRedViolet"
Data$"PaleRobinEggBlue","PaleSilver","PaleSpringBud","PaleTaupe"
Data$"PaleTurquoise","PaleViolet","PaleVioletRed","PapayaWhip","PastelBlue"
Data$"PastelGray","PastelMagenta","PastelOrange","PastelPink","PastelPurple"
Data$"PastelViolet","PastelYellow","Peach","Peach_","PeachOrange","PeachPuff"
Data$"PeachYellow","Pear","Pearl","PearlAqua","Periwinkle","PersianPink"
Data$"Phlox","PictonBlue","PiggyPink","Pink","PinkLace","PinkLavender"
Data$"PinkOrange","PinkPearl","PinkSherbet","Platinum","Plum_Web","PowderBlue"
Data$"PsychedelicPurple","Puce","PurplePizzazz","QueenPink","Rajah"
Data$"RazzleDazzleRose","RichBrilliantLavender","RichLavender","RichLilac"
Data$"RoseBonbon","RosePink","RoseQuartz","RosyBrown","RoyalYellow","RuddyPink"
Data$"Saffron","Sage","Salmon","SalmonPink","Sand","Sandstorm","SandyBrown"
Data$"SchaussPink","SchoolBusYellow","ScreaminGreen","Seashell","Shampoo"
Data$"ShimmeringBlush","ShockingPink_Crayola","Silver","SilverChalice"
Data$"SilverPink","SilverSand","SkyBlue","SkyMagenta","Snow","Soap"
Data$"SpanishPink","SpanishSkyBlue","StilDeGrainYellow","Straw","Strawberry"
Data$"Sunglow","Sunray","Sunset","SuperPink","Tan","TeaGreen","TeaRose"
Data$"TeaRose_","TealDeer","Thistle","ThulianPink","TickleMePink","Timberwolf"
Data$"TitaniumYellow","Topaz","Tulip","Tumbleweed","Turquoise","TurquoiseBlue"
Data$"TurquoiseGreen","Tuscan","Tuscany","UltraPink","UltraRed"
Data$"UnbleachedSilk","UnitedNationsBlue","UnmellowYellow","Vanilla"
Data$"VanillaIce","VegasGold","VeryLightAzure","VeryLightMalachiteGreen"
Data$"VeryLightTangelo","VeryPaleOrange","VeryPaleYellow","Violet_Web"
Data$"VioletRed","VistaBlue","VividTangerine","VividYellow","Waterspout"
Data$"Wheat","White","WhiteSmoke","WildBlueYonder","WildOrchid"
Data$"WildStrawberry","WildWatermelon","Wisteria","Yellow","Yellow_Crayola"
Data$"Yellow_NCS","Yellow_Pantone","Yellow_Process","Yellow_RYB","YellowOrange"
Values:
Data.l 8174056,13238245,11699390,7512257,15792383,15720141,15834299,15922164
Data.l 13473141,16444375,16502449,65535,8388564,15324779,11714229,16750950
Data.l 16641536,15794175,15794175,14412276,9031664,10603249,16040642,16711418
Data.l 16748975,16443317,16769333,12375270,16119260,16770244,16772045,11331054
Data.l 16445630,10658512,14932681,12555492,14193135,13737960,16038911,16733603
Data.l 16474239,16761292,15204095,15785090,14596231,9544624,16774656,10731949
Data.l 15711180,16772864,16754377,9609679,11329967,11730943,16246734,15110060
Data.l 14679808,16758725,14577569,16501991,12900578,16286585,16286585,16510045
Data.l 6591981,16775388,16775399,16760025,16776656,65535,16765696,16777009
Data.l 15786288,11119017,7237369,12433259,11119017,7839435,9859030,15308410
Data.l 9419919,9223894,13745832,16438949,12670145,16107290,13923284,16763812
Data.l 15583663,12186367,15060169,15720379,14788959,12759680,15788758,8255999
Data.l 65535,16038911,16777011,9881762,15051376,16635313,16551596,16247182
Data.l 15654018,16775920,10419512,13923284,16608414,7845374,10938367,16711935
Data.l 12670145,16742399,14474460,16316671,15132922,16766720,16768768,11068576
Data.l 12500670,11403055,15324779,14644223,11180201,15794160,16719310,16738740
Data.l 7448274,16578398,11725917,14919767,16052460,11730943,16777200,16309886
Data.l 16042518,9091569,12442199,12824721,15787660,15179716,14076637,16777062
Data.l 11123357,11894492,15132410,13421823,16773365,12895184,9721835,15631086
Data.l 15132410,16494290,16490723,16774912,16775885,16645888,14941952,16181950
Data.l 16774223,12227544,16635313,11393254,8957152,15761536,9686250,16083345
Data.l 14745599,16735437,13151615,16352495,16448210,13882323,13408716,9498256
Data.l 16757726,15787660,13867979,11394989,15116503,11640025,16758465,16752762
Data.l 16751001,8900346,11584734,15110060,16777184,13148872,16445670,14577569
Data.l 7119068,16770253,16711935,16733603,11202769,16315647,16510045,9935530
Data.l 14725375,15702186,7586555,15054651,6741418,15984043,14524637,12211667
Data.l 9662683,8444651,8087790,13229191,4772300,16300152,16309886,16628916
Data.l 14940552,16121850,10026904,16770273,16444375,7580098,16767832,16166342
Data.l 16439902,16768685,9721835,16753475,14123903,10804717,15335387,16643558
Data.l 12027047,14315734,15908301,12375270,11529966,10208482,14527919,11259375
Data.l 8901624,15122058,15657130,10025880,14471423,16352485,16751052,16440029
Data.l 14524637,14381203,9887441,13222075,15526845,12359806,11529966,13408767
Data.l 14381203,16773077,11454159,13619140,16030402,16757575,14591396,11771573
Data.l 13343177,16645526,16770484,16763812,16764057,16767673,16441261,13754929
Data.l 15392968,8968384,13421823,16220094,14614783,4567528,16637414,16761035
Data.l 16768500,14201553,16750950,15183055,16224167,15066338,14524637,11591910
Data.l 14614783,13404313,16666330,15256791,16493408,16724940,15837182,10972111
Data.l 11953874,16335518,16737996,11180201,12357519,16439902,14782102,16041008
Data.l 12368010,16416882,16748964,12759680,15521088,16032864,16748975,16766976
Data.l 7798650,16774638,16764913,14255765,16740351,12632256,11316396,12889773
Data.l 12566978,8900331,13595055,16775930,13551855,16236478,65535,16439902
Data.l 14997871,16538253,16763955,14920535,16438949,13593513,13808780,13693120
Data.l 16286585,16040642,10086067,14204888,14577569,16550316,14407634,15656448
Data.l 16763004,16746381,14592648,4251856,65519,10540724,16438949,12622233
Data.l 16740351,16542853,16768458,6001381,16777062,15984043,15962025,12956504
Data.l 7650299,6613382,16756855,16768959,16777151,15631086,16208788,8167129
Data.l 16752777,16769794,10810617,16113331,16777215,16119285,10661328,13922466
Data.l 16728996,16542853,13213916,16776960,16574595,16765696,16703232,16772864
EndDataSection
Procedure$ SpecialColorRequester (Parent, CurrentColor. l = #Null)
DisableWindow (Parent, #True)
Dim N$ (383)
Dim CV. l (383)
Flags = #PB_Window_SystemMenu| #PB_Window_ScreenCentered
Window = OpenWindow (#PB_Any, 0, 0, 530, 470, "XMAS Color Requester", Flags)
Restore Names
For CI = 0 To 383
Read$ N$ (CI)
Next
Restore Values
For CI = 0 To 383
Read. l CV (CI)
CV (CI) = RGB (Blue (CV (CI)), Green (CV (CI)), Red (CV (CI)))
I = CreateImage (#PB_Any, 25, 22, 32, CV (CI))
PX = 15 + 25 * Mod (CI, 20)
PY = 15 + 22 * Int (CI / 20)
ButtonImageGadget (CI, PX, PY, 25, 22, ImageID (I))
GadgetToolTip (CI, N$ (CI))
Next
For CI = 0 To 383
Next
Repeat
Select WaitWindowEvent ()
Case #PB_Event_Gadget
CloseWindow (Window)
DisableWindow (Parent, #False)
SetActiveWindow (Parent)
ProcedureReturn N$ (EventGadget ()) + "; $" + Hex(CV (EventGadget ()))
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
CloseWindow (Window)
DisableWindow (Parent, #False)
SetActiveWindow (Parent)
EndProcedure
Flags = #PB_Window_SystemMenu| #PB_Window_ScreenCentered
Window = OpenWindow (#PB_Any, #Null, #Null, 630, 336, "XMAS colorzZz", Flags)
Button = ButtonGadget (#PB_Any, 245, 157, 140, 23, "Pick a color!", 1)
Text = TextGadget (#PB_Any, 410, 300, 200, 20, "", #PB_Text_Right)
Repeat
Select WaitWindowEvent ()
Case #PB_Event_Gadget
NC$ = SpecialColorRequester (Window, OldColor)
NewColor = Val (Right (NC$, Len (NC$) - FindString (NC$, "; ") - 1))
If Not NewColor = 0
SetWindowColor (Window, NewColor)
SetGadgetColor (Text, #PB_Gadget_BackColor, NewColor)
SetGadgetText (Text, NC$)
OldColor = NewColor
EndIf
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver