Jump to content

Recommended Posts

Posted (edited)

Okay,

This is my first release so be gentle.

Basically what this is is a list of colors in the format of

$colorname = 0x000000

Why do we need this? Well imagine you want your background to be red! well just do this

GUISetBkColor( -1, $red )

Now at this point im sure youre think, so what! you defined the color red! I defined 140 individual colors all available by calling the _ShowColorList() command.

This command tells you the name of each color and gives you a visual preview of how it looks!

PICS:

Posted Image

DL Link!

DOWNLOAD NOW! v1.0

Also i got the list of colors from here:

HTML Color Codes

Edited by insignia96

Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower

Posted

I like the idea looks great, why not put the files on this site? I know when I use a color for my programs I add the color one varable at a time by looks in a file with the color and the hex, this would save time for me

Gnatwork Networks

Posted

Why orange?

Why not blue or green?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted

what the color he's typing in? blue is my favorite color, but I am wearing a bright orange shirt so I like the orange color he typed it

Gnatwork Networks

Posted (edited)

I changed a few things to make it look nicer and it easier to read.

Color.au3

;----------------------------------------------------------------------------
;
; AutoIt Version: 3.3.0.0
; Author:         insignia96
;
; Defining Colors
;----------------------------------------------------------------------------

#include-once

Global $ColorList[140][2]  = [["Black", 0x000000],["Navy", 0x000080],["DarkBlue", 0x00008B],["MediumBlue", 0x0000CD],["Blue", 0x0000FF], _
                             ["DarkGreen", 0x006400],["Green", 0x008000],["Teal", 0x008080],["DarkCyan", 0x008B8B],["DeepSkyBlue", 0x00BFFF], _
                             ["DarkTurquoise", 0x00CED1],["MediumSpringGreen", 0x00FA9A],["Lime", 0x00FF00],["SpringGreen", 0x00FF7F],["Aqua", 0x00FFFF], _
                             ["Cyan", 0x00FFFF],["MidnightBlue", 0x191970],["DodgerBlue", 0x1E90FF],["LightSeaGreen", 0x20B2AA],["ForestGreen", 0x228B22], _
                             ["SeaGreen", 0x2E8B57],["DarkSlateGray", 0x2F4F4F],["LimeGreen", 0x32CD32],["MediumSeaGreen", 0x3CB371],["Turquoise", 0x40E0D0], _
                             ["RoyalBlue", 0x4169E1],["SteelBlue", 0x4682B4],["DarkSlateBlue", 0x483D8B],["MediumTurquoise", 0x48D1CC],["Indigo", 0x4B0082], _
                             ["DarkOliveGreen", 0x556B2F],["CadetBlue", 0x5F9EA0],["CornflowerBlue", 0x6495ED],["MediumAquaMarine", 0x66CDAA],["DimGray", 0x696969], _
                             ["SlateBlue", 0x6A5ACD],["OliveDrab", 0x6B8E23],["SlateGray", 0x708090],["LightSlateGray", 0x778899],["MediumSlateBlue", 0x7B68EE], _
                             ["LawnGreen", 0x7CFC00],["Chartreuse", 0x7FFF00],["Aquamarine", 0x7FFFD4],["Maroon", 0x800000],["Purple", 0x800080],["Olive", 0x808000], _
                             ["Gray", 0x808080],["SkyBlue", 0x87CEEB],["LightSkyBlue", 0x87CEFA],["BlueViolet", 0x8A2BE2],["DarkRed", 0x8B0000],["DarkMagenta", 0x8B008B], _
                             ["SaddleBrown", 0x8B4513],["DarkSeaGreen", 0x8FBC8F],["LightGreen", 0x90EE90],["MediumPurple", 0x9370D8],["DarkViolet", 0x9400D3], _
                             ["PaleGreen", 0x98FB98],["DarkOrchid", 0x9932CC],["YellowGreen", 0x9ACD32],["Sienna", 0xA0522D],["Brown", 0xA52A2A],["DarkGray", 0xA9A9A9], _
                             ["LightBlue", 0xADD8E6],["GreenYellow", 0xADFF2F],["PaleTurquoise", 0xAFEEEE],["LightSteelBlue", 0xB0C4DE],["PowderBlue", 0xB0E0E6], _
                             ["FireBrick", 0xB22222],["DarkGoldenRod", 0xB8860B],["MediumOrchid", 0xBA55D3],["RosyBrown", 0xBC8F8F],["DarkKhaki", 0xBDB76B],["Silver", 0xC0C0C0], _
                             ["MediumVioletRed", 0xC71585],["IndianRed", 0xCD5C5C],["Peru", 0xCD853F],["Chocolate", 0xD2691E],["Tan", 0xD2B48C],["LightGrey", 0xD3D3D3], _
                             ["PaleVioletRed", 0xD87093],["Thistle", 0xD8BFD8],["Orchid", 0xDA70D6],["GoldenRod", 0xDAA520],["Crimson", 0xDC143C],["Gainsboro", 0xDCDCDC], _
                             ["Plum", 0xDDA0DD],["BurlyWood", 0xDEB887],["LightCyan", 0xE0FFFF],["Lavender", 0xE6E6FA],["DarkSalmon", 0xE9967A],["Violet", 0xEE82EE], _
                             ["PaleGoldenRod", 0xEEE8AA],["LightCoral", 0xF08080],["Khaki", 0xF0E68C],["AliceBlue", 0xF0F8FF],["HoneyDew", 0xF0FFF0],["Azure", 0xF0FFFF], _
                             ["SandyBrown", 0xF4A460],["Wheat", 0xF5DEB3],["Beige", 0xF5F5DC],["WhiteSmoke", 0xF5F5F5],["MintCream", 0xF5FFFA],["GhostWhite", 0xF8F8FF], _
                             ["Salmon", 0xFA8072],["AntiqueWhite", 0xFAEBD7],["Linen", 0xFAF0E6],["LightGoldenRodYellow", 0xFAFAD2],["OldLace", 0xFDF5E6],["Red", 0xFF0000], _
                             ["Fuchsia", 0xFF00FF],["Magenta", 0xFF00FF],["DeepPink", 0xFF1493],["OrangeRed", 0xFF4500],["Tomato", 0xFF6347],["HotPink", 0xFF69B4], _
                             ["Coral", 0xFF7F50],["Darkorange", 0xFF8C00],["LightSalmon", 0xFFA07A],["Orange", 0xFFA500],["LightPink", 0xFFB6C1],["Pink", 0xFFC0CB], _
                             ["Gold", 0xFFD700],["PeachPuff", 0xFFDAB9],["NavajoWhite", 0xFFDEAD],["Moccasin", 0xFFE4B5],["Bisque", 0xFFE4C4],["MistyRose", 0xFFE4E1], _
                             ["BlanchedAlmond", 0xFFEBCD],["PapayaWhip", 0xFFEFD5],["LavenderBlush", 0xFFF0F5],["SeaShell", 0xFFF5EE],["Cornsilk", 0xFFF8DC], _
                             ["LemonChiffon", 0xFFFACD],["FloralWhite", 0xFFFAF0],["Snow", 0xFFFAFA],["Yellow", 0xFFFF00],["LightYellow", 0xFFFFE0],["Ivory", 0xFFFFF0],["White", 0xFFFFFF]]

Func _ShowColorList()
$hwnd = GUICreate("Show Colors", 450, 451, 193, 125)
$colors = GUICtrlCreateListView("Name|Color", 8, 8, 433, 433)
GUICtrlSendMsg($colors, 0x101E, 0, 340)

For $c = 0 to UBound($ColorList)-1
    GUICtrlCreateListViewItem($ColorList[$c][0] & "|0x" & Hex($ColorList[$c][1],6), $colors)
    _GuiCtrlSetBkColorByName( -1, $ColorList[$c][0])
    GUICtrlSetColor(-1, _LightDark($ColorList[$c][1]))
Next

GUISetState( @SW_SHOW )

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
    EndSwitch
WEnd
EndFunc
;
Func _LightDark($i_Color)
    If $i_Color > 0xFFFFFF/2 Then $o_Color = 0x000000
    If $i_Color < 0xFFFFFF/2 Then $o_Color = 0xFFFFFF
    Return $o_Color
EndFunc

Func _GuiCtrlSetColorByName($control, $name)
    For $n = 0 To UBound($ColorList)-1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc

Func _GuiCtrlSetBkColorByName($control, $name)
    For $n = 0 To UBound($ColorList)-1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetBkColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc
Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Posted (edited)

  billthecreator said:

I changed a few things to make it look nicer and it easier to read.

Color.au3

;----------------------------------------------------------------------------
;
; AutoIt Version: 3.3.0.0
; Author:         insignia96
;
; Defining Colors
;----------------------------------------------------------------------------

#include-once

Global $ColorList[140][2]  = [["Black", 0x000000],["Navy", 0x000080],["DarkBlue", 0x00008B],["MediumBlue", 0x0000CD],["Blue", 0x0000FF], _
                             ["DarkGreen", 0x006400],["Green", 0x008000],["Teal", 0x008080],["DarkCyan", 0x008B8B],["DeepSkyBlue", 0x00BFFF], _
                             ["DarkTurquoise", 0x00CED1],["MediumSpringGreen", 0x00FA9A],["Lime", 0x00FF00],["SpringGreen", 0x00FF7F],["Aqua", 0x00FFFF], _
                             ["Cyan", 0x00FFFF],["MidnightBlue", 0x191970],["DodgerBlue", 0x1E90FF],["LightSeaGreen", 0x20B2AA],["ForestGreen", 0x228B22], _
                             ["SeaGreen", 0x2E8B57],["DarkSlateGray", 0x2F4F4F],["LimeGreen", 0x32CD32],["MediumSeaGreen", 0x3CB371],["Turquoise", 0x40E0D0], _
                             ["RoyalBlue", 0x4169E1],["SteelBlue", 0x4682B4],["DarkSlateBlue", 0x483D8B],["MediumTurquoise", 0x48D1CC],["Indigo", 0x4B0082], _
                             ["DarkOliveGreen", 0x556B2F],["CadetBlue", 0x5F9EA0],["CornflowerBlue", 0x6495ED],["MediumAquaMarine", 0x66CDAA],["DimGray", 0x696969], _
                             ["SlateBlue", 0x6A5ACD],["OliveDrab", 0x6B8E23],["SlateGray", 0x708090],["LightSlateGray", 0x778899],["MediumSlateBlue", 0x7B68EE], _
                             ["LawnGreen", 0x7CFC00],["Chartreuse", 0x7FFF00],["Aquamarine", 0x7FFFD4],["Maroon", 0x800000],["Purple", 0x800080],["Olive", 0x808000], _
                             ["Gray", 0x808080],["SkyBlue", 0x87CEEB],["LightSkyBlue", 0x87CEFA],["BlueViolet", 0x8A2BE2],["DarkRed", 0x8B0000],["DarkMagenta", 0x8B008B], _
                             ["SaddleBrown", 0x8B4513],["DarkSeaGreen", 0x8FBC8F],["LightGreen", 0x90EE90],["MediumPurple", 0x9370D8],["DarkViolet", 0x9400D3], _
                             ["PaleGreen", 0x98FB98],["DarkOrchid", 0x9932CC],["YellowGreen", 0x9ACD32],["Sienna", 0xA0522D],["Brown", 0xA52A2A],["DarkGray", 0xA9A9A9], _
                             ["LightBlue", 0xADD8E6],["GreenYellow", 0xADFF2F],["PaleTurquoise", 0xAFEEEE],["LightSteelBlue", 0xB0C4DE],["PowderBlue", 0xB0E0E6], _
                             ["FireBrick", 0xB22222],["DarkGoldenRod", 0xB8860B],["MediumOrchid", 0xBA55D3],["RosyBrown", 0xBC8F8F],["DarkKhaki", 0xBDB76B],["Silver", 0xC0C0C0], _
                             ["MediumVioletRed", 0xC71585],["IndianRed", 0xCD5C5C],["Peru", 0xCD853F],["Chocolate", 0xD2691E],["Tan", 0xD2B48C],["LightGrey", 0xD3D3D3], _
                             ["PaleVioletRed", 0xD87093],["Thistle", 0xD8BFD8],["Orchid", 0xDA70D6],["GoldenRod", 0xDAA520],["Crimson", 0xDC143C],["Gainsboro", 0xDCDCDC], _
                             ["Plum", 0xDDA0DD],["BurlyWood", 0xDEB887],["LightCyan", 0xE0FFFF],["Lavender", 0xE6E6FA],["DarkSalmon", 0xE9967A],["Violet", 0xEE82EE], _
                             ["PaleGoldenRod", 0xEEE8AA],["LightCoral", 0xF08080],["Khaki", 0xF0E68C],["AliceBlue", 0xF0F8FF],["HoneyDew", 0xF0FFF0],["Azure", 0xF0FFFF], _
                             ["SandyBrown", 0xF4A460],["Wheat", 0xF5DEB3],["Beige", 0xF5F5DC],["WhiteSmoke", 0xF5F5F5],["MintCream", 0xF5FFFA],["GhostWhite", 0xF8F8FF], _
                             ["Salmon", 0xFA8072],["AntiqueWhite", 0xFAEBD7],["Linen", 0xFAF0E6],["LightGoldenRodYellow", 0xFAFAD2],["OldLace", 0xFDF5E6],["Red", 0xFF0000], _
                             ["Fuchsia", 0xFF00FF],["Magenta", 0xFF00FF],["DeepPink", 0xFF1493],["OrangeRed", 0xFF4500],["Tomato", 0xFF6347],["HotPink", 0xFF69B4], _
                             ["Coral", 0xFF7F50],["Darkorange", 0xFF8C00],["LightSalmon", 0xFFA07A],["Orange", 0xFFA500],["LightPink", 0xFFB6C1],["Pink", 0xFFC0CB], _
                             ["Gold", 0xFFD700],["PeachPuff", 0xFFDAB9],["NavajoWhite", 0xFFDEAD],["Moccasin", 0xFFE4B5],["Bisque", 0xFFE4C4],["MistyRose", 0xFFE4E1], _
                             ["BlanchedAlmond", 0xFFEBCD],["PapayaWhip", 0xFFEFD5],["LavenderBlush", 0xFFF0F5],["SeaShell", 0xFFF5EE],["Cornsilk", 0xFFF8DC], _
                             ["LemonChiffon", 0xFFFACD],["FloralWhite", 0xFFFAF0],["Snow", 0xFFFAFA],["Yellow", 0xFFFF00],["LightYellow", 0xFFFFE0],["Ivory", 0xFFFFF0],["White", 0xFFFFFF]]

Func _ShowColorList()
$hwnd = GUICreate("Show Colors", 450, 451, 193, 125)
$colors = GUICtrlCreateListView("Name|Color", 8, 8, 433, 433)
GUICtrlSendMsg($colors, 0x101E, 0, 340)

For $c = 0 to UBound($ColorList)-1
    GUICtrlCreateListViewItem($ColorList[$c][0] & "|0x" & Hex($ColorList[$c][1],6), $colors)
    _GuiCtrlSetBkColorByName( -1, $ColorList[$c][0])
    GUICtrlSetColor(-1, _LightDark($ColorList[$c][1]))
Next

GUISetState( @SW_SHOW )

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
    EndSwitch
WEnd
EndFunc
;
Func _LightDark($i_Color)
    If $i_Color > 0xFFFFFF/2 Then $o_Color = 0x000000
    If $i_Color < 0xFFFFFF/2 Then $o_Color = 0xFFFFFF
    Return $o_Color
EndFunc

Func _GuiCtrlSetColorByName($control, $name)
    For $n = 0 To UBound($ColorList)-1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc

Func _GuiCtrlSetBkColorByName($control, $name)
    For $n = 0 To UBound($ColorList)-1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetBkColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc
:) Thanks for this man, it looks a lot better! And i didnt attach the files to this post because i visit many forums and the ones i usually go to mostly have rules aginst the attachment system unless it is needed. Anyways im glad people find it useful and not stupid!

EDIT: Just realized but this rewrite kinda defeats my purpose, i was trying to make it so you only had to type in a variable quick to get a color. In this rewrite you would have to call the array and blah blah blah.

Edited by insignia96

Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower

Posted
  insignia96 said:

EDIT: Just realized but this rewrite kinda defeats my purpose, i was trying to make it so you only had to type in a variable quick to get a color. In this rewrite you would have to call the array and blah blah blah.

Its the same thing. only instead of a variable, its a String. and 'ByName' is added to the color function. its not that much...

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Posted

  insignia96 said:

EDIT: Just realized but this rewrite kinda defeats my purpose, i was trying to make it so you only had to type in a variable quick to get a color. In this rewrite you would have to call the array and blah blah blah.

  billthecreator said:

Its the same thing. only instead of a variable, its a String. and 'ByName' is added to the color function. its not that much...

To make you both happy, you could add this after the array declaration in billthecreator's version:

For $C = 0 To UBound($ColorList)-1
    Assign($ColorList[$c][0], $ColorList[$c][1])
Next
;Msgbox(0, "", "LemonChiifon is: " & @crlf & $lemonChiffon & @Crlf & "0x" & Hex($lemonChiffon))
  • 7 years later...
  • 10 months later...
Posted

Any chance I can see this in action. I'm still a little lost how or when to call it to get a color list.  @insignia96 site is down and his example code is not available anymore. I also see @ResNullius added some code himself to help out but not sure where he added that so if someone has the final version and a sample call from a gui on how it operates will do wonders to understand it more.

 

Thanks.

Posted
;----------------------------------------------------------------------------
;
; AutoIt Version: 3.3.0.0
; Author:         insignia96
;
; Defining Colors
;----------------------------------------------------------------------------

#include-once

Global $ColorList[140][2] = [["Black", 0x000000], ["Navy", 0x000080], ["DarkBlue", 0x00008B], ["MediumBlue", 0x0000CD], ["Blue", 0x0000FF], _
        ["DarkGreen", 0x006400], ["Green", 0x008000], ["Teal", 0x008080], ["DarkCyan", 0x008B8B], ["DeepSkyBlue", 0x00BFFF], _
        ["DarkTurquoise", 0x00CED1], ["MediumSpringGreen", 0x00FA9A], ["Lime", 0x00FF00], ["SpringGreen", 0x00FF7F], ["Aqua", 0x00FFFF], _
        ["Cyan", 0x00FFFF], ["MidnightBlue", 0x191970], ["DodgerBlue", 0x1E90FF], ["LightSeaGreen", 0x20B2AA], ["ForestGreen", 0x228B22], _
        ["SeaGreen", 0x2E8B57], ["DarkSlateGray", 0x2F4F4F], ["LimeGreen", 0x32CD32], ["MediumSeaGreen", 0x3CB371], ["Turquoise", 0x40E0D0], _
        ["RoyalBlue", 0x4169E1], ["SteelBlue", 0x4682B4], ["DarkSlateBlue", 0x483D8B], ["MediumTurquoise", 0x48D1CC], ["Indigo", 0x4B0082], _
        ["DarkOliveGreen", 0x556B2F], ["CadetBlue", 0x5F9EA0], ["CornflowerBlue", 0x6495ED], ["MediumAquaMarine", 0x66CDAA], ["DimGray", 0x696969], _
        ["SlateBlue", 0x6A5ACD], ["OliveDrab", 0x6B8E23], ["SlateGray", 0x708090], ["LightSlateGray", 0x778899], ["MediumSlateBlue", 0x7B68EE], _
        ["LawnGreen", 0x7CFC00], ["Chartreuse", 0x7FFF00], ["Aquamarine", 0x7FFFD4], ["Maroon", 0x800000], ["Purple", 0x800080], ["Olive", 0x808000], _
        ["Gray", 0x808080], ["SkyBlue", 0x87CEEB], ["LightSkyBlue", 0x87CEFA], ["BlueViolet", 0x8A2BE2], ["DarkRed", 0x8B0000], ["DarkMagenta", 0x8B008B], _
        ["SaddleBrown", 0x8B4513], ["DarkSeaGreen", 0x8FBC8F], ["LightGreen", 0x90EE90], ["MediumPurple", 0x9370D8], ["DarkViolet", 0x9400D3], _
        ["PaleGreen", 0x98FB98], ["DarkOrchid", 0x9932CC], ["YellowGreen", 0x9ACD32], ["Sienna", 0xA0522D], ["Brown", 0xA52A2A], ["DarkGray", 0xA9A9A9], _
        ["LightBlue", 0xADD8E6], ["GreenYellow", 0xADFF2F], ["PaleTurquoise", 0xAFEEEE], ["LightSteelBlue", 0xB0C4DE], ["PowderBlue", 0xB0E0E6], _
        ["FireBrick", 0xB22222], ["DarkGoldenRod", 0xB8860B], ["MediumOrchid", 0xBA55D3], ["RosyBrown", 0xBC8F8F], ["DarkKhaki", 0xBDB76B], ["Silver", 0xC0C0C0], _
        ["MediumVioletRed", 0xC71585], ["IndianRed", 0xCD5C5C], ["Peru", 0xCD853F], ["Chocolate", 0xD2691E], ["Tan", 0xD2B48C], ["LightGrey", 0xD3D3D3], _
        ["PaleVioletRed", 0xD87093], ["Thistle", 0xD8BFD8], ["Orchid", 0xDA70D6], ["GoldenRod", 0xDAA520], ["Crimson", 0xDC143C], ["Gainsboro", 0xDCDCDC], _
        ["Plum", 0xDDA0DD], ["BurlyWood", 0xDEB887], ["LightCyan", 0xE0FFFF], ["Lavender", 0xE6E6FA], ["DarkSalmon", 0xE9967A], ["Violet", 0xEE82EE], _
        ["PaleGoldenRod", 0xEEE8AA], ["LightCoral", 0xF08080], ["Khaki", 0xF0E68C], ["AliceBlue", 0xF0F8FF], ["HoneyDew", 0xF0FFF0], ["Azure", 0xF0FFFF], _
        ["SandyBrown", 0xF4A460], ["Wheat", 0xF5DEB3], ["Beige", 0xF5F5DC], ["WhiteSmoke", 0xF5F5F5], ["MintCream", 0xF5FFFA], ["GhostWhite", 0xF8F8FF], _
        ["Salmon", 0xFA8072], ["AntiqueWhite", 0xFAEBD7], ["Linen", 0xFAF0E6], ["LightGoldenRodYellow", 0xFAFAD2], ["OldLace", 0xFDF5E6], ["Red", 0xFF0000], _
        ["Fuchsia", 0xFF00FF], ["Magenta", 0xFF00FF], ["DeepPink", 0xFF1493], ["OrangeRed", 0xFF4500], ["Tomato", 0xFF6347], ["HotPink", 0xFF69B4], _
        ["Coral", 0xFF7F50], ["Darkorange", 0xFF8C00], ["LightSalmon", 0xFFA07A], ["Orange", 0xFFA500], ["LightPink", 0xFFB6C1], ["Pink", 0xFFC0CB], _
        ["Gold", 0xFFD700], ["PeachPuff", 0xFFDAB9], ["NavajoWhite", 0xFFDEAD], ["Moccasin", 0xFFE4B5], ["Bisque", 0xFFE4C4], ["MistyRose", 0xFFE4E1], _
        ["BlanchedAlmond", 0xFFEBCD], ["PapayaWhip", 0xFFEFD5], ["LavenderBlush", 0xFFF0F5], ["SeaShell", 0xFFF5EE], ["Cornsilk", 0xFFF8DC], _
        ["LemonChiffon", 0xFFFACD], ["FloralWhite", 0xFFFAF0], ["Snow", 0xFFFAFA], ["Yellow", 0xFFFF00], ["LightYellow", 0xFFFFE0], ["Ivory", 0xFFFFF0], ["White", 0xFFFFFF]]

_ShowColorList()

Func _ShowColorList()
    $hwnd = GUICreate("Show Colors", 450, 451, 193, 125)
    $colors = GUICtrlCreateListView("Name|Color", 8, 8, 433, 433)
    GUICtrlSendMsg($colors, 0x101E, 0, 340)

    For $c = 0 To UBound($ColorList) - 1
        GUICtrlCreateListViewItem($ColorList[$c][0] & "|0x" & Hex($ColorList[$c][1], 6), $colors)
        _GuiCtrlSetBkColorByName(-1, $ColorList[$c][0])
        GUICtrlSetColor(-1, _LightDark($ColorList[$c][1]))
    Next

    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case -3
                Exit
        EndSwitch
    WEnd
EndFunc   ;==>_ShowColorList
;
Func _LightDark($i_Color)
    If $i_Color > 0xFFFFFF / 2 Then $o_Color = 0x000000
    If $i_Color < 0xFFFFFF / 2 Then $o_Color = 0xFFFFFF
    Return $o_Color
EndFunc   ;==>_LightDark

Func _GuiCtrlSetColorByName($control, $name)
    For $n = 0 To UBound($ColorList) - 1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc   ;==>_GuiCtrlSetColorByName

Func _GuiCtrlSetBkColorByName($control, $name)
    For $n = 0 To UBound($ColorList) - 1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetBkColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc   ;==>_GuiCtrlSetBkColorByName

 

Posted

Thanks @KaFu I created a new gui inside the colorlist.au3 and didn't notice it was already declaring a window.

That was the easy part. I just wasn't sure what @billthecreator was doing and i figured it out. He meant to add his code if you want to use colorlist.au3 as an include file and with his code you can use the variable names setup in colorlist file in your own program.

I marked it up a little. Here is the full code for anyone who is not firing on all cylinders at some time like me today:

 

;----------------------------------------------------------------------------
;
; AutoIt Version: 3.3.0.0
; Author:         insignia96
;
; Defining Colors
; You may include this with a project then refer by any color listed below
; eq. $MediumSeaGrean will be available in your project
;----------------------------------------------------------------------------

#include-once

Global $ColorList[140][2]  = _
   [["Black", 0x000000],["Navy", 0x000080],["DarkBlue", 0x00008B],["MediumBlue", 0x0000CD],["Blue", 0x0000FF], _
   ["DarkGreen", 0x006400],["Green", 0x008000],["Teal", 0x008080],["DarkCyan", 0x008B8B],["DeepSkyBlue", 0x00BFFF], _
   ["DarkTurquoise", 0x00CED1],["MediumSpringGreen", 0x00FA9A],["Lime", 0x00FF00],["SpringGreen", 0x00FF7F],["Aqua", 0x00FFFF], _
   ["Cyan", 0x00FFFF],["MidnightBlue", 0x191970],["DodgerBlue", 0x1E90FF],["LightSeaGreen", 0x20B2AA],["ForestGreen", 0x228B22], _
   ["SeaGreen", 0x2E8B57],["DarkSlateGray", 0x2F4F4F],["LimeGreen", 0x32CD32],["MediumSeaGreen", 0x3CB371],["Turquoise", 0x40E0D0], _
   ["RoyalBlue", 0x4169E1],["SteelBlue", 0x4682B4],["DarkSlateBlue", 0x483D8B],["MediumTurquoise", 0x48D1CC],["Indigo", 0x4B0082], _
   ["DarkOliveGreen", 0x556B2F],["CadetBlue", 0x5F9EA0],["CornflowerBlue", 0x6495ED],["MediumAquaMarine", 0x66CDAA],["DimGray", 0x696969], _
   ["SlateBlue", 0x6A5ACD],["OliveDrab", 0x6B8E23],["SlateGray", 0x708090],["LightSlateGray", 0x778899],["MediumSlateBlue", 0x7B68EE], _
   ["LawnGreen", 0x7CFC00],["Chartreuse", 0x7FFF00],["Aquamarine", 0x7FFFD4],["Maroon", 0x800000],["Purple", 0x800080],["Olive", 0x808000], _
   ["Gray", 0x808080],["SkyBlue", 0x87CEEB],["LightSkyBlue", 0x87CEFA],["BlueViolet", 0x8A2BE2],["DarkRed", 0x8B0000],["DarkMagenta", 0x8B008B], _
   ["SaddleBrown", 0x8B4513],["DarkSeaGreen", 0x8FBC8F],["LightGreen", 0x90EE90],["MediumPurple", 0x9370D8],["DarkViolet", 0x9400D3], _
   ["PaleGreen", 0x98FB98],["DarkOrchid", 0x9932CC],["YellowGreen", 0x9ACD32],["Sienna", 0xA0522D],["Brown", 0xA52A2A],["DarkGray", 0xA9A9A9], _
   ["LightBlue", 0xADD8E6],["GreenYellow", 0xADFF2F],["PaleTurquoise", 0xAFEEEE],["LightSteelBlue", 0xB0C4DE],["PowderBlue", 0xB0E0E6], _
   ["FireBrick", 0xB22222],["DarkGoldenRod", 0xB8860B],["MediumOrchid", 0xBA55D3],["RosyBrown", 0xBC8F8F],["DarkKhaki", 0xBDB76B],["Silver", 0xC0C0C0], _
   ["MediumVioletRed", 0xC71585],["IndianRed", 0xCD5C5C],["Peru", 0xCD853F],["Chocolate", 0xD2691E],["Tan", 0xD2B48C],["LightGrey", 0xD3D3D3], _
   ["PaleVioletRed", 0xD87093],["Thistle", 0xD8BFD8],["Orchid", 0xDA70D6],["GoldenRod", 0xDAA520],["Crimson", 0xDC143C],["Gainsboro", 0xDCDCDC], _
   ["Plum", 0xDDA0DD],["BurlyWood", 0xDEB887],["LightCyan", 0xE0FFFF],["Lavender", 0xE6E6FA],["DarkSalmon", 0xE9967A],["Violet", 0xEE82EE], _
   ["PaleGoldenRod", 0xEEE8AA],["LightCoral", 0xF08080],["Khaki", 0xF0E68C],["AliceBlue", 0xF0F8FF],["HoneyDew", 0xF0FFF0],["Azure", 0xF0FFFF], _
   ["SandyBrown", 0xF4A460],["Wheat", 0xF5DEB3],["Beige", 0xF5F5DC],["WhiteSmoke", 0xF5F5F5],["MintCream", 0xF5FFFA],["GhostWhite", 0xF8F8FF], _
   ["Salmon", 0xFA8072],["AntiqueWhite", 0xFAEBD7],["Linen", 0xFAF0E6],["LightGoldenRodYellow", 0xFAFAD2],["OldLace", 0xFDF5E6],["Red", 0xFF0000], _
   ["Fuchsia", 0xFF00FF],["Magenta", 0xFF00FF],["DeepPink", 0xFF1493],["OrangeRed", 0xFF4500],["Tomato", 0xFF6347],["HotPink", 0xFF69B4], _
   ["Coral", 0xFF7F50],["Darkorange", 0xFF8C00],["LightSalmon", 0xFFA07A],["Orange", 0xFFA500],["LightPink", 0xFFB6C1],["Pink", 0xFFC0CB], _
   ["Gold", 0xFFD700],["PeachPuff", 0xFFDAB9],["NavajoWhite", 0xFFDEAD],["Moccasin", 0xFFE4B5],["Bisque", 0xFFE4C4],["MistyRose", 0xFFE4E1], _
   ["BlanchedAlmond", 0xFFEBCD],["PapayaWhip", 0xFFEFD5],["LavenderBlush", 0xFFF0F5],["SeaShell", 0xFFF5EE],["Cornsilk", 0xFFF8DC], _
   ["LemonChiffon", 0xFFFACD],["FloralWhite", 0xFFFAF0],["Snow", 0xFFFAFA],["Yellow", 0xFFFF00],["LightYellow", 0xFFFFE0], _
   ["Ivory", 0xFFFFF0],["White", 0xFFFFFF]]

; Tip: Unremark the following line to run colorlist from the command line and show a GUI of all the colors
; _ShowColorList()

For $C = 0 To UBound($ColorList)-1
    Assign($ColorList[$c][0], $ColorList[$c][1]);Assigns the names to a string eq. $PeachPuff is the color peachpuff
Next
;Msgbox(0, "", "LemonChiifon is: " & @crlf & $lemonChiffon & @Crlf & "0x" & Hex($lemonChiffon))


Func _ShowColorList()
   $hwnd = GUICreate("Show Colors", 450, 451, 193, 125)
   $colors = GUICtrlCreateListView("Name|Color", 8, 8, 433, 433)
   GUICtrlSendMsg($colors, 0x101E, 0, 340)

   For $c = 0 to UBound($ColorList)-1
       GUICtrlCreateListViewItem($ColorList[$c][0] & "|0x" & Hex($ColorList[$c][1],6), $colors)
       _GuiCtrlSetBkColorByName( -1, $ColorList[$c][0])
       GUICtrlSetColor(-1, _LightDark($ColorList[$c][1]))
   Next

   GUISetState( @SW_SHOW )

   While 1
       $nMsg = GUIGetMsg()
       Switch $nMsg
           Case -3
               Exit
       EndSwitch
   WEnd
EndFunc
;
Func _LightDark($i_Color)
    If $i_Color > 0xFFFFFF/2 Then $o_Color = 0x000000
    If $i_Color < 0xFFFFFF/2 Then $o_Color = 0xFFFFFF
    Return $o_Color
EndFunc

Func _GuiCtrlSetColorByName($control, $name)
    For $n = 0 To UBound($ColorList)-1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc

Func _GuiCtrlSetBkColorByName($control, $name)
    For $n = 0 To UBound($ColorList)-1
        Switch $ColorList[$n][0]
            Case $name
                GUICtrlSetBkColor($control, $ColorList[$n][1])
        EndSwitch
    Next
EndFunc

Thanks again.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...