Android Code Snippet Designer Colours

Discussion in 'Code Snippets' started by PhiloSophical, Jan 8, 2018.

  1. PhiloSophical

    PhiloSophical Member Licensed User

    I spent a dull hour copying these colour settings into a class.

    These are the colours used in the designer which has a very nice drop down pickable list together with names. I personally think these are nice descriptive names.

    There are probably more ways to handle colours than there are people in the forum but how about the following ideas.

    @Erel - could you make a colour picker work in the code IDE the same as the designer IDE? Update already done - Thanks I'm a release out of date.
    @Erel - could an inbuilt "colors" class look like the one below - "colors2" say?
    @Erel - could the IDE use the tool tip mechanism so that if a literal such as 0xFFF5F5DC were hovered over - then a colour block pops up to show that colour (not may literals of this format are likely to be anything other than colours - agree?)
    @anyone - could someone advise or build out the stuff below into a nice custom control that can be dropped onto forms. I can do this myself but I know there are people with greater talents than myself who can do a better job. I've done some typing for us!

    I've put the code together to build a map "zMap" which can can at least be used (refactored) to populate some control.

    I may have reinvented a wheel here so don't be too harsh if there's a better way or an existing class using the designer IDE colours and names that I have missed.

    Code:
    Sub Class_Globals
        
    Dim AntiqueWhite As Int=0xFFFAEBD7
        
    Dim Aqua As Int = 0xFF00FFFF
        
    Dim Aquamarine As Int=0xFF7FFFD4
        
    Dim Azure As Int = 0xFFF0FFFF
        
    Dim Beige As Int = 0xFFF5F5DC
        
    Dim Bisque As Int = 0xFFFFE4C4
        
    Dim Black As Int = 0xFF000000
        
    Dim BlanchedAlmond As Int = 0xFFFFEBCD
        
    Dim Blue As Int = 0xFF0000FF
        
    Dim BlueViolet As Int = 0xFF8A2BE2
        
    Dim Brown As Int = 0xFFA52A2A
        
    Dim BurlyWood As Int = 0xFFDEB887
        
    Dim CadetBlue As Int = 0xFF5F9EA0
        
    Dim Chartreuse As Int = 0xFF7FFF00
        
    Dim Chocolate As Int = 0xFFD2691E
        
    Dim Coral As Int = 0xFFFF7F50
        
    Dim CornflowerBlue As Int = 0xFF6495ED
        
    Dim Cornsilk As Int = 0xFFFFF8DC
        
    Dim Crimson As Int = 0xFFDC143C
        
    Dim Cyan As Int = 0xFF00FFFF
        
    Dim DarkBlue As Int = 0xFF00008B
        
    Dim DarkCyan As Int = 0xFF008B8B
        
    Dim DarkGoldenrod As Int = 0xFFB8860B
        
    Dim DarkGray As Int = 0xFFA9A9A9
        
    Dim DarkGreen As Int = 0xFF006400
        
    Dim DarkKhaki As Int = 0xFFBDB76B
        
    Dim DarkMagenta As Int = 0xFF8B008B
        
    Dim DarkOliveGreen As Int = 0xFF556B2F
        
    Dim DarkOrange As Int = 0xFFFF8C00
        
    Dim DarkOrchid As Int = 0xFF9932CC
        
    Dim DarkRed As Int = 0xFF8B0000
        
    Dim DarkSalmon As Int = 0xFFE9967A
        
    Dim DarkSeaGreen As Int = 0xFF8FBC8F
        
    Dim DarkSlateBlue As Int = 0xFF483D8B
        
    Dim DarkSlateGray As Int = 0xFF2F4F4F
        
    Dim DarkTurquoise As Int = 0xFF00CED1
        
    Dim DarkViolet As Int = 0xFF9400D3
        
    Dim DeepPink As Int = 0xFFFF1493
        
    Dim DarkPink As Int = 0xFFFF1493
        
    Dim DeepSkyBlue As Int = 0xFF00BFFF
        
    Dim DarkSkyBlue As Int = 0xFF00BFFF
        
    Dim DimGray As Int = 0xFF696969
        
    Dim DodgerBlue As Int = 0xFF1E90FF
        
    Dim Firebrick As Int = 0xFFB22222
        
    Dim FloralWhite As Int = 0xFFFFFAF0
        
    Dim ForestGreen As Int = 0xFF228B22
        
    Dim Fuchsia As Int = 0xFFFF00FF
        
    Dim Gainsboro As Int = 0xFFDCDCDC
        
    Dim GhostWhite As Int = 0xFFF8F8FF
        
    Dim Gold As Int = 0xFFFFD700
        
    Dim Goldenrod As Int = 0xFFDAA520
        
    Dim Gray As Int = 0xFF808080
        
    Dim Green As Int = 0xFF008000
        
    Dim GreenYellow As Int = 0xFFADFF2F
        
    Dim Honeydew As Int = 0xFFF0FFF0
        
    Dim HotPink As Int = 0xFFFF69B4
        
    Dim IndianRed As Int = 0xFFCD5C5C
        
    Dim Indigo As Int = 0xFF4B0082
        
    Dim Ivory As Int = 0xFFFFFFF0
        
    Dim Khaki As Int = 0xFFF0E68C
        
    Dim Lavender As Int = 0xFFE6E6FA
        
    Dim LavenderBlush As Int = 0xFFFFF0F5
        
    Dim LawnGreen As Int = 0xFF7CFC00
        
    Dim LemonChiffon As Int = 0xFFFFFACD
        
    Dim LightBlue As Int = 0xFFADD8E6
        
    Dim LightCoral As Int = 0xFFF08080
        
    Dim LightCyan As Int = 0xFFE0FFFF
        
    Dim LightGoldenrodYellow As Int = 0xFFFAFAD2
        
    Dim LightGray As Int = 0xFFD3D3D3
        
    Dim LightGreen As Int = 0xFF90EE90
        
    Dim LightPink As Int = 0xFFFFB6C1
        
    Dim LightSalmon As Int = 0xFFFFA07A
        
    Dim LightSeaGreen As Int = 0xFF20B2AA
        
    Dim LightSkyBlue As Int = 0xFF87CEFA
        
    Dim LightSlateGray As Int = 0xFF778899
        
    Dim LightSteelBlue As Int = 0xFFB0C4DE
        
    Dim LightYellow As Int = 0xFFFFFFE0
        
    Dim Lime As Int = 0xFF00FF00
        
    Dim LimeGreen As Int = 0xFF32CD32
        
    Dim Linen As Int = 0xFFFAF0E6
        
    Dim Magenta As Int = 0xFFFF00FF
        
    Dim Maroon As Int = 0xFF800000
        
    Dim MediumAquamarine As Int = 0xFF66CDAA
        
    Dim MediumBlue As Int = 0xFF0000CD
        
    Dim MediumOrchid As Int = 0xFFBA55D3
        
    Dim MediumPurple As Int = 0xFF9370DB
        
    Dim MediumSeaGreen As Int = 0xFF3CB371
        
    Dim MediumSlateBlue As Int = 0xFF7B68EE
        
    Dim MediumSpringGreen As Int = 0xFF00FA9A
        
    Dim MediumTurquoise As Int = 0xFF48D1CC
        
    Dim MediumVioletRed As Int = 0xFFC71585
        
    Dim MidnightBlue As Int = 0xFF191970
        
    Dim MintCream As Int = 0xFFF5FFFA
        
    Dim MistyRose As Int = 0xFFFFE4E1
        
    Dim Moccasin As Int = 0xFFFFE4B5
        
    Dim NavajoWhite As Int = 0xFFFFDEAD
        
    Dim Navy As Int = 0xFF000080
        
    Dim OldLace As Int = 0xFFFDF5E6
        
    Dim Olive As Int = 0xFF808000
        
    Dim OliveDrab As Int = 0xFF6B8E23
        
    Dim Orange As Int = 0xFFFFA500
        
    Dim OrangeRed As Int = 0xFFFF4500
        
    Dim Orchid As Int = 0xFFDA70D6
        
    Dim PaleGoldenrod As Int = 0xFFEEE8AA
        
    Dim PaleGreen As Int = 0xFF98FB98
        
    Dim PaleTurquoise As Int = 0xFFAFEEEE
        
    Dim PaleVioletRed As Int = 0xFFDB7093
        
    Dim PapayaWhip As Int = 0xFFFFEFD5
        
    Dim PeachPuff As Int = 0xFFFFDAB9
        
    Dim Peru As Int = 0xFFCD853F
        
    Dim Pink As Int = 0xFFFFC0CB
        
    Dim Plum As Int = 0xFFDDA0DD
        
    Dim PowderBlue As Int = 0xFFB0E0E6
        
    Dim Purple As Int = 0xFF800080
        
    Dim Red As Int = 0xFFFF0000
        
    Dim RosyBrown As Int = 0xFFBC8F8F
        
    Dim RoyalBlue As Int = 0xFF4169E1
        
    Dim SaddleBrown As Int = 0xFF8B4513
        
    Dim Salmon As Int = 0xFFFA8072
        
    Dim SandyBrown As Int = 0xFFF4A460
        
    Dim SeaGreen As Int = 0xFF2E8B57
        
    Dim SeaShell As Int = 0xFFFFF5EE
        
    Dim Sienna As Int = 0xFFA0522D
        
    Dim Silver As Int = 0xFFC0C0C0
        
    Dim SkyBlue As Int = 0xFF87CEEB
        
    Dim SlateBlue As Int = 0xFF6A5ACD
        
    Dim SlateGray As Int = 0xFF708090
        
    Dim Snow As Int = 0xFFFFFAFA
        
    Dim SpringGreen As Int = 0xFF00FF7F
        
    Dim SteelBlue As Int = 0xFF4682B4
        
    Dim Tan1 As Int = 0xFFD2B48C
        
    Dim Teal As Int = 0xFF008080
        
    Dim Thistle As Int = 0xFFD8BFD8
        
    Dim Tomato As Int = 0xFFFF6347
        
    Dim Transparent As Int = 0x00FFFFFF
        
    Dim Turquoise As Int = 0xFF40E0D0
        
    Dim Violet As Int = 0xFFEE82EE
        
    Dim Wheat As Int = 0xFFF5DEB3
        
    Dim White As Int = 0xFFFFFFFF
        
    Dim WhiteSmoke As Int = 0xFFF5F5F5
        
    Dim Yellow As Int = 0xFFFFFF00
        
    Dim YellowGreen As Int = 0xFF9ACD32
     
        
    Dim zMap As Map
    End Sub

    'Initializes the object. You can add parameters to this method if needed.
    Public Sub Initialize
        zMap.initialize
        zMap.Put(
    "AntiqueWhite",AntiqueWhite)
        zMap.Put(
    "Aqua", Aqua)
        zMap.Put(
    "Aquamarine",Aquamarine)
        zMap.Put(
    "Azure", Azure)
        zMap.Put(
    "Beige", Beige)
        zMap.Put(
    "Bisque", Bisque)
        zMap.Put(
    "Black", Black)
        zMap.Put(
    "BlanchedAlmond", BlanchedAlmond)
        zMap.Put(
    "Blue", Blue)
        zMap.Put(
    "BlueViolet", BlueViolet)
        zMap.Put(
    "Brown", Brown)
        zMap.Put(
    "BurlyWood", BurlyWood)
        zMap.Put(
    "CadetBlue", CadetBlue)
        zMap.Put(
    "Chartreuse", Chartreuse)
        zMap.Put(
    "Chocolate", Chocolate)
        zMap.Put(
    "Coral", Coral)
        zMap.Put(
    "CornflowerBlue", CornflowerBlue)
        zMap.Put(
    "Cornsilk", Cornsilk)
        zMap.Put(
    "Crimson", Crimson)
        zMap.Put(
    "Cyan", Cyan)
        zMap.Put(
    "DarkBlue", DarkBlue)
        zMap.Put(
    "DarkCyan", DarkCyan)
        zMap.Put(
    "DarkGoldenrod", DarkGoldenrod)
        zMap.Put(
    "DarkGray", DarkGray)
        zMap.Put(
    "DarkGreen", DarkGreen)
        zMap.Put(
    "DarkKhaki", DarkKhaki)
        zMap.Put(
    "DarkMagenta", DarkMagenta)
        zMap.Put(
    "DarkOliveGreen", DarkOliveGreen)
        zMap.Put(
    "DarkOrange", DarkOrange)
        zMap.Put(
    "DarkOrchid", DarkOrchid)
        zMap.Put(
    "DarkRed", DarkRed)
        zMap.Put(
    "DarkSalmon", DarkSalmon)
        zMap.Put(
    "DarkSeaGreen", DarkSeaGreen)
        zMap.Put(
    "DarkSlateBlue", DarkSlateBlue)
        zMap.Put(
    "DarkSlateGray", DarkSlateGray)
        zMap.Put(
    "DarkTurquoise", DarkTurquoise)
        zMap.Put(
    "DarkViolet", DarkViolet)
        zMap.Put(
    "DeepPink", DeepPink)
        zMap.Put(
    "DarkPink", DarkPink)
        zMap.Put(
    "DeepSkyBlue", DeepSkyBlue)
        zMap.Put(
    "DarkSkyBlue", DarkSkyBlue)
        zMap.Put(
    "DimGray", DimGray)
        zMap.Put(
    "DodgerBlue", DodgerBlue)
        zMap.Put(
    "Firebrick", Firebrick)
        zMap.Put(
    "FloralWhite", FloralWhite)
        zMap.Put(
    "ForestGreen", ForestGreen)
        zMap.Put(
    "Fuchsia", Fuchsia)
        zMap.Put(
    "Gainsboro", Gainsboro)
        zMap.Put(
    "GhostWhite", GhostWhite)
        zMap.Put(
    "Gold", Gold)
        zMap.Put(
    "Goldenrod", Goldenrod)
        zMap.Put(
    "Gray", Gray)
        zMap.Put(
    "Green", Green)
        zMap.Put(
    "GreenYellow", GreenYellow)
        zMap.Put(
    "Honeydew", Honeydew)
        zMap.Put(
    "HotPink", HotPink)
        zMap.Put(
    "IndianRed", IndianRed)
        zMap.Put(
    "Indigo", Indigo)
        zMap.Put(
    "Ivory", Ivory)
        zMap.Put(
    "Khaki", Khaki)
        zMap.Put(
    "Lavender", Lavender)
        zMap.Put(
    "LavenderBlush", LavenderBlush)
        zMap.Put(
    "LawnGreen", LawnGreen)
        zMap.Put(
    "LemonChiffon", LemonChiffon)
        zMap.Put(
    "LightBlue", LightBlue)
        zMap.Put(
    "LightCoral", LightCoral)
        zMap.Put(
    "LightCyan", LightCyan)
        zMap.Put(
    "LightGoldenrodYellow", LightGoldenrodYellow)
        zMap.Put(
    "LightGray", LightGray)
        zMap.Put(
    "LightGreen", LightGreen)
        zMap.Put(
    "LightPink", LightPink)
        zMap.Put(
    "LightSalmon", LightSalmon)
        zMap.Put(
    "LightSeaGreen", LightSeaGreen)
        zMap.Put(
    "LightSkyBlue", LightSkyBlue)
        zMap.Put(
    "LightSlateGray", LightSlateGray)
        zMap.Put(
    "LightSteelBlue", LightSteelBlue)
        zMap.Put(
    "LightYellow", LightYellow)
        zMap.Put(
    "Lime", Lime)
        zMap.Put(
    "LimeGreen", LimeGreen)
        zMap.Put(
    "Linen", Linen)
        zMap.Put(
    "Magenta", Magenta)
        zMap.Put(
    "Maroon", Maroon)
        zMap.Put(
    "MediumAquamarine", MediumAquamarine)
        zMap.Put(
    "MediumBlue", MediumBlue)
        zMap.Put(
    "MediumOrchid", MediumOrchid)
        zMap.Put(
    "MediumPurple", MediumPurple)
        zMap.Put(
    "MediumSeaGreen", MediumSeaGreen)
        zMap.Put(
    "MediumSlateBlue", MediumSlateBlue)
        zMap.Put(
    "MediumSpringGreen", MediumSpringGreen)
        zMap.Put(
    "MediumTurquoise", MediumTurquoise)
        zMap.Put(
    "MediumVioletRed", MediumVioletRed)
        zMap.Put(
    "MidnightBlue", MidnightBlue)
        zMap.Put(
    "MintCream", MintCream)
        zMap.Put(
    "MistyRose", MistyRose)
        zMap.Put(
    "Moccasin", Moccasin)
        zMap.Put(
    "NavajoWhite", NavajoWhite)
        zMap.Put(
    "Navy", Navy)
        zMap.Put(
    "OldLace", OldLace)
        zMap.Put(
    "Olive", Olive)
        zMap.Put(
    "OliveDrab", OliveDrab)
        zMap.Put(
    "Orange", Orange)
        zMap.Put(
    "OrangeRed", OrangeRed)
        zMap.Put(
    "Orchid", Orchid)
        zMap.Put(
    "PaleGoldenrod", PaleGoldenrod)
        zMap.Put(
    "PaleGreen", PaleGreen)
        zMap.Put(
    "PaleTurquoise", PaleTurquoise)
        zMap.Put(
    "PaleVioletRed", PaleVioletRed)
        zMap.Put(
    "PapayaWhip", PapayaWhip)
        zMap.Put(
    "PeachPuff", PeachPuff)
        zMap.Put(
    "Peru", Peru)
        zMap.Put(
    "Pink", Pink)
        zMap.Put(
    "Plum", Plum)
        zMap.Put(
    "PowderBlue", PowderBlue)
        zMap.Put(
    "Purple", Purple)
        zMap.Put(
    "Red", Red)
        zMap.Put(
    "RosyBrown", RosyBrown)
        zMap.Put(
    "RoyalBlue", RoyalBlue)
        zMap.Put(
    "SaddleBrown",SaddleBrown)
        zMap.Put(
    "Salmon", Salmon)
        zMap.Put(
    "SandyBrown", SandyBrown)
        zMap.Put(
    "SeaGreen", SeaGreen)
        zMap.Put(
    "SeaShell", SeaShell)
        zMap.Put(
    "Sienna", Sienna)
        zMap.Put(
    "Silver", Silver)
        zMap.Put(
    "SkyBlue", SkyBlue)
        zMap.Put(
    "SlateBlue", SlateBlue)
        zMap.Put(
    "SlateGray", SlateGray)
        zMap.Put(
    "Snow", Snow)
        zMap.Put(
    "SpringGreen", SpringGreen)
        zMap.Put(
    "SteelBlue", SteelBlue)
        zMap.Put(
    "Tan1", Tan1)
        zMap.Put(
    "Teal", Teal)
        zMap.Put(
    "Thistle", Thistle)
        zMap.Put(
    "Tomato", Tomato)
        zMap.Put(
    "Transparent", Transparent)
        zMap.Put(
    "Turquoise", Turquoise)
        zMap.Put(
    "Violet", Violet)
        zMap.Put(
    "Wheat", Wheat)
        zMap.Put(
    "White", White)
        zMap.Put(
    "WhiteSmoke", WhiteSmoke)
        zMap.Put(
    "Yellow", Yellow)
        zMap.Put(
    "YellowGreen", YellowGreen)

    '    For i = 1 To zMap.Size
    '        Log (zMap.GetkeyAt(i-1)&" - "&zMap.GetValueAt(i-1))
    '    Next
    End Sub
     
    Last edited: Jan 8, 2018
    Multiverse app likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Right click on the code editor and choose Color Picker.

    [​IMG]
     
    metrick and Claudio Oliveira like this.
Loading...