Core Function Colour

From Sputnik Wiki
Jump to: navigation, search
Colour( <name> )

Contents

Description

Get the INT value of a given colours name.

Parameters

name

The name of the colour, See Remarks for a list.

Return Value

The colour as a numeric value 0x R G B.

Remarks

Valid colours to enter are:

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

Example

// Create the MDI GUI
$GUI = GUICreate("Window", "GUI", 640, 480);
// Show the MDI GUI
GUILoad( $GUI );
 
// Make tab
$obj_TAB = GUICreate("TabSheet", $GUI, 5, 15, 610,  370);
// Add pages
$TabPage1 = GUICreate("TabPage", $obj_TAB, "Testy Tab1");
$TabPage2 = GUICreate("TabPage", $obj_TAB, "Testy Tab2");
$TabPage3 = GUICreate("TabPage", $obj_TAB, "Testy Tab3");
// Add buttons
$T1_Button1 = GUICreate("Button", $TabPage1, "My Button Tab1", 8, 8);
$T2_Button1 = GUICreate("Button", $TabPage2, "My Button Tab2", 8, 48);
$T3_Button1 = GUICreate("Button", $TabPage3, "My Button Tab3", 48, 38);
 
// Change the main window to Yellow
GUISetProp($GUI, "BackColor", Colour("Pink")); // Make it Pink
println("Main Window BackColour" . Hex(GUIGetProp($GUI, "BackColor"))); // Print the colour
 
// Change the button background colours
GUISetProp($T1_Button1, "BackColor", Colour("Red")); // Make it Red
GUISetProp($T2_Button1, "BackColor", Colour("Blue")); // Make it Blue
GUISetProp($T3_Button1, "BackColor", Colour("Green")); // Make it Green
// Get the hex of the colours so we could use it somewhere else
$HexB1 = Hex(GUIGetProp($T1_Button1, "BackColor"));
$HexB2 = Hex(GUIGetProp($T2_Button1, "BackColor"));
$HexB3 = Hex(GUIGetProp($T3_Button1, "BackColor"));
// Print the hex
println("Button 1 BackColour $HexB1");
println("Button 2 BackColour $HexB2");
println("Button 3 BackColour $HexB2");
 
// Change the button foreground (Text) colours
GUISetProp($T1_Button1, "ForeColor", Colour("Green")); // Make it Green
GUISetProp($T2_Button1, "ForeColor", Colour("Blue")); // Make it Red
GUISetProp($T3_Button1, "ForeColor", Colour("Red")); // Make it Blue
//GUISetProp($T3_Button1, "ForeColor", "Default"); // This will remove the colour!
// Get the hex of the colours so we could use it somewhere else
$HexB1 = Hex(GUIGetProp($T1_Button1, "ForeColor"));
$HexB2 = Hex(GUIGetProp($T2_Button1, "ForeColor"));
$HexB3 = Hex(GUIGetProp($T3_Button1, "ForeColor"));
// Print the hex
println("Button 1 ForeColour $HexB1");
println("Button 2 ForeColour $HexB2");
println("Button 3 ForeColour $HexB2");
 
// Keep the GUI running as long as long as the window is open
While ( GUIStatus( $GUI ) ) DoEvents( );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox