No announcement yet.

Color Equates in Arrays

  • Filter
  • Time
  • Show
Clear All
new posts

  • Color Equates in Arrays

    Code to put the %rgb_xxx color equates into arrays. Just in case someone has a use for them.

    Global ColorsRed(), ColorsPink(), ColorsOrange(), ColorsYellow(), ColorsPurple() As Long
    Global ColorsGreen(), ColorsBlue(), ColorsBrown(), ColorsWhite(), ColorsGray() As Long
    Sub AssignColors
       ReDim ColorsRed(9), ColorsPink(6), ColorsOrange(6), ColorsYellow(11), ColorsPurple(17), ColorsGreen(23), ColorsBlue(24), ColorsBrown(17), ColorsWhite(17), ColorsGray(10)
       Array Assign ColorsRed()    =%rgb_IndianRed, %rgb_LightCoral, %rgb_Salmon, %rgb_DarkSalmon, %rgb_LightSalmon, %rgb_Crimson, %rgb_Red, %rgb_FireBrick, %rgb_DarkRed
       Array Assign ColorsPink()   =%rgb_Pink, %rgb_LightPink, %rgb_HotPink, %rgb_DeepPink, %rgb_MediumVioletRed, %rgb_PaleVioletRed
       Array Assign ColorsOrange() =%rgb_LightSalmon, %rgb_Coral, %rgb_Tomato, %rgb_OrangeRed, %rgb_DarkOrange, %rgb_Orange
       Array Assign ColorsYellow() =%rgb_Gold, %rgb_Yellow, %rgb_LightYellow, %rgb_LemonChiffon, %rgb_LightGoldenrodYellow, %rgb_PapayaWhip, %rgb_Moccasin, %rgb_PeachPuff, %rgb_PaleGoldenrod, %rgb_Khaki, %rgb_DarkKhaki
       Array Assign ColorsPurple() =%rgb_Lavender, %rgb_Thistle, %rgb_Plum, %rgb_Violet, %rgb_Orchid, %rgb_Magenta, %rgb_MediumOrchid, %rgb_MediumPurple, %rgb_BlueViolet, %rgb_DarkViolet, %rgb_DarkOrchid, %rgb_DarkMagenta, _
                                   %rgb_Purple, %rgb_Indigo,%rgb_SlateBlue, %rgb_DarkSlateBlue, %rgb_MediumSlateBlue
       Array Assign ColorsGreen()  =%rgb_GreenYellow, %rgb_Chartreuse, %rgb_LawnGreen, %rgb_Lime, %rgb_LimeGreen, %rgb_PaleGreen, %rgb_LightGreen, %rgb_MediumSpringGreen, %rgb_SpringGreen, %rgb_MediumSeaGreen, %rgb_SeaGreen, _
                                   %rgb_ForestGreen, %rgb_Green,%rgb_DarkGreen, %rgb_YellowGreen, %rgb_OliveDrab, %rgb_Olive, %rgb_DarkOliveGreen, %rgb_MediumAquamarine, %rgb_DarkSeaGreen, %rgb_LightSeaGreen, %rgb_DarkCyan, %rgb_Teal
       Array Assign ColorsBlue()   =%rgb_Cyan, %rgb_LightCyan, %rgb_PaleTurquoise, %rgb_Aquamarine, %rgb_Turquoise, %rgb_MediumTurquoise, %rgb_DarkTurquoise, %rgb_CadetBlue, %rgb_SteelBlue, %rgb_LightSteelBlue, %rgb_PowderBlue, _
                                   %rgb_LightBlue, %rgb_SkyBlue,%rgb_LightSkyBlue, %rgb_DeepSkyBlue, %rgb_DodgerBlue, %rgb_CornflowerBlue, %rgb_MediumSlateBlue, %rgb_RoyalBlue, %rgb_Blue, %rgb_MediumBlue, %rgb_DarkBlue, %rgb_Navy, %rgb_MidnightBlue
       Array Assign ColorsBrown()  =%rgb_Cornsilk, %rgb_BlanchedAlmond, %rgb_Bisque, %rgb_NavajoWhite, %rgb_Wheat, %rgb_BurlyWood, %rgb_Tan, %rgb_RosyBrown, %rgb_SandyBrown, %rgb_Goldenrod, %rgb_DarkGoldenrod, %rgb_Peru, _
                                   %rgb_Chocolate, %rgb_SaddleBrown,%rgb_Sienna, %rgb_Brown, %rgb_Maroon
       Array Assign ColorsWhite()  =%rgb_White, %rgb_Snow, %rgb_Honeydew, %rgb_MintCream, %rgb_Azure, %rgb_AliceBlue, %rgb_GhostWhite, %rgb_WhiteSmoke, %rgb_Seashell, %rgb_Beige, %rgb_OldLace, %rgb_FloralWhite, %rgb_Ivory, _
                                   %rgb_AntiqueWhite, %rgb_Linen,%rgb_LavenderBlush, %rgb_MistyRose
       Array Assign ColorsGray()   =%rgb_Gainsboro, %rgb_LightGray, %rgb_Silver, %rgb_DarkGray, %rgb_Gray, %rgb_DimGray, %rgb_LightSlateGray, %rgb_SlateGray, %rgb_DarkSlateGray, %rgb_Black
    End Sub

  • #2
    Thanks Gary. With so much details to overcome on some of my projects. Those lines of code helped me work some problems out I was going to have to take on.
    I have not yet created a listing of colors that you might consider standard colors for sets of 256 or smaller and for sure 128, 64,32,16,8 and 2.
    From my reading about color indexed bitmaps, there can be unexpected results if you converted a large array colored bitmap that is not indexed to one of the few other kinds of bitmaps that are referred as color indexed bitmaps. That is all another story for another thread but if one needed to limit colors to a certain color selection. You will find yourself needing colors in arrays and basicly grouping sets of colors in separate arrays can be very productive to achieving a lot of wanted results. And sure makes it easier to built a complete array and manage color sets.
    Thank you
    p purvis