Color
Table of contents
Represent a color value in a 32-bit ARGB format. Declared as:
type Color uint32
Type has three variants of text representations which can be used while describing resources or property value from code
Values | Description |
---|---|
"#AARRGGBB" "#RRGGBB" "#ARGB" "#RGB" |
A, R, G and B are hexadecimal digits describing the corresponding component. If the alpha channel is not specified, then it is considered equal to FF. If the color component is specified by one digit, then it is doubled, therefore “#48AD” is equivalent to “#4488AADD” |
"rgba(R, G, B, A)" "rgb(R, G, B)" |
R, G, B and A are representation of the color component. The component can be set as a float number in the range [0 … 1], or as an integer in the range [0 … 255], or as a percentage from 0% to 100% |
"black" "white" ... |
The name of the color. Library has a list of supported color names, see below |
Examples
"#FFBEBEBE"
"#BEBEBE"
"#FBBB"
"#BBB"
"rgba(255, 128, 96, 255)"
"rgba(50%, 128, .5, 100%)"
"rgb(1.0, .5, .8)"
"rgb(0%, 50%, 25%)"
Color constants
Name | Color |
---|---|
black | #ff000000 |
silver | #ffc0c0c0 |
gray | #ff808080 |
white | #ffffffff |
maroon | #ff800000 |
red | #ffff0000 |
purple | #ff800080 |
fuchsia | #ffff00ff |
green | #ff008000 |
lime | #ff00ff00 |
olive | #ff808000 |
yellow | #ffffff00 |
navy | #ff000080 |
blue | #ff0000ff |
teal | #ff008080 |
aqua | #ff00ffff |
orange | #ffffa500 |
aliceblue | #fff0f8ff |
antiquewhite | #fffaebd7 |
aquamarine | #ff7fffd4 |
azure | #fff0ffff |
beige | #fff5f5dc |
bisque | #ffffe4c4 |
blanchedalmond | #ffffebcd |
blueviolet | #ff8a2be2 |
brown | #ffa52a2a |
burlywood | #ffdeb887 |
cadetblue | #ff5f9ea0 |
chartreuse | #ff7fff00 |
chocolate | #ffd2691e |
coral | #ffff7f50 |
cornflowerblue | #ff6495ed |
cornsilk | #fffff8dc |
crimson | #ffdc143c |
cyan | #ff00ffff |
darkblue | #ff00008b |
darkcyan | #ff008b8b |
darkgoldenrod | #ffb8860b |
darkgray | #ffa9a9a9 |
darkgreen | #ff006400 |
darkgrey | #ffa9a9a9 |
darkkhaki | #ffbdb76b |
darkmagenta | #ff8b008b |
darkolivegreen | #ff556b2f |
darkorange | #ffff8c00 |
darkorchid | #ff9932cc |
darkred | #ff8b0000 |
darksalmon | #ffe9967a |
darkseagreen | #ff8fbc8f |
darkslateblue | #ff483d8b |
darkslategray | #ff2f4f4f |
darkslategrey | #ff2f4f4f |
darkturquoise | #ff00ced1 |
darkviolet | #ff9400d3 |
deeppink | #ffff1493 |
deepskyblue | #ff00bfff |
dimgray | #ff696969 |
dimgrey | #ff696969 |
dodgerblue | #ff1e90ff |
firebrick | #ffb22222 |
floralwhite | #fffffaf0 |
forestgreen | #ff228b22 |
gainsboro | #ffdcdcdc |
ghostwhite | #fff8f8ff |
gold | #ffffd700 |
goldenrod | #ffdaa520 |
greenyellow | #ffadff2f |
grey | #ff808080 |
honeydew | #fff0fff0 |
hotpink | #ffff69b4 |
indianred | #ffcd5c5c |
indigo | #ff4b0082 |
ivory | #fffffff0 |
khaki | #fff0e68c |
lavender | #ffe6e6fa |
lavenderblush | #fffff0f5 |
lawngreen | #ff7cfc00 |
lemonchiffon | #fffffacd |
lightblue | #ffadd8e6 |
lightcoral | #fff08080 |
lightcyan | #ffe0ffff |
lightgoldenrodyellow | #fffafad2 |
lightgray | #ffd3d3d3 |
lightgreen | #ff90ee90 |
lightgrey | #ffd3d3d3 |
lightpink | #ffffb6c1 |
lightsalmon | #ffffa07a |
lightseagreen | #ff20b2aa |
lightskyblue | #ff87cefa |
lightslategray | #ff778899 |
lightslategrey | #ff778899 |
lightsteelblue | #ffb0c4de |
lightyellow | #ffffffe0 |
limegreen | #ff32cd32 |
linen | #fffaf0e6 |
magenta | #ffff00ff |
mediumaquamarine | #ff66cdaa |
mediumblue | #ff0000cd |
mediumorchid | #ffba55d3 |
mediumpurple | #ff9370db |
mediumseagreen | #ff3cb371 |
mediumslateblue | #ff7b68ee |
mediumspringgreen | #ff00fa9a |
mediumturquoise | #ff48d1cc |
mediumvioletred | #ffc71585 |
midnightblue | #ff191970 |
mintcream | #fff5fffa |
mistyrose | #ffffe4e1 |
moccasin | #ffffe4b5 |
navajowhite | #ffffdead |
oldlace | #fffdf5e6 |
olivedrab | #ff6b8e23 |
orangered | #ffff4500 |
orchid | #ffda70d6 |
palegoldenrod | #ffeee8aa |
palegreen | #ff98fb98 |
paleturquoise | #ffafeeee |
palevioletred | #ffdb7093 |
papayawhip | #ffffefd5 |
peachpuff | #ffffdab9 |
peru | #ffcd853f |
pink | #ffffc0cb |
plum | #ffdda0dd |
powderblue | #ffb0e0e6 |
rosybrown | #ffbc8f8f |
royalblue | #ff4169e1 |
saddlebrown | #ff8b4513 |
salmon | #fffa8072 |
sandybrown | #fff4a460 |
seagreen | #ff2e8b57 |
seashell | #fffff5ee |
sienna | #ffa0522d |
skyblue | #ff87ceeb |
slateblue | #ff6a5acd |
slategray | #ff708090 |
slategrey | #ff708090 |
snow | #fffffafa |
springgreen | #ff00ff7f |
steelblue | #ff4682b4 |
tan | #ffd2b48c |
thistle | #ffd8bfd8 |
tomato | #ffff6347 |
turquoise | #ff40e0d0 |
violet | #ffee82ee |
wheat | #fff5deb3 |
whitesmoke | #fff5f5f5 |
yellowgreen | #ff9acd32 |
Create from source
func StringToColor(text string) (Color, bool)
Converts the string argument to Color
value
view := rui.NewListLayout(session, rui.Params{
rui.Width: rui.Percent(100),
rui.Height: rui.Percent(100),
rui.BackgroundColor: 0xFFBEBEBE,
})
view := rui.NewListLayout(session, rui.Params{
rui.Width: rui.Percent(100),
rui.Height: rui.Percent(100),
rui.BackgroundColor: "#FFBEBEBE",
})
view := rui.NewListLayout(session, rui.Params{
rui.Width: rui.Percent(100),
rui.Height: rui.Percent(100),
rui.BackgroundColor: "rgba(255, 128, 96, 255)",
})
view := rui.NewListLayout(session, rui.Params{
rui.Width: rui.Percent(100),
rui.Height: rui.Percent(100),
rui.BackgroundColor: "white",
})
Create from resource
View {
width = 100%,
height = 100%,
background-color = #FFBEBEBE,
}
View {
width = 100%,
height = 100%,
background-color = white,
}
View {
width = 100%,
height = 100%,
background-color = "rgba(255, 128, 96, 255)",
}
Related global functions
func NamedColors() []NamedColor
Returns the list of named colors