color QML Basic Type

A color is a standard color name in quotes.

A color is a standard color name in quotes. It is normally specified as an SVG color name. These names include colors like "red", "green" and "lightsteelblue".

If the color you want isn't part of this list, colors can also be specified in hexidecimal triplets or quads that take the form "#RRGGBB" and "#AARRGGBB" respectively. For example, the color red corresponds to a triplet of "#FF0000" and a slightly transparent blue to a quad of "#800000FF".

Example:

Rectangle {
    color: "steelblue"
    width: 40; height: 40
}
Rectangle {
    color: "transparent"
    y: 40; width: 40; height: 40
}
Rectangle {
    color: "#FF0000"
    y: 80; width: 40; height: 40
}
Rectangle {
    color: "#800000FF"
    y: 120; width: 40; height: 40
}
Rectangle {
    color: "#00000000"    // ARGB fully transparent
    y: 160
    width: 40; height: 40
}

Or with the Qt.rgba(), Qt.hsla(), Qt.darker(), Qt.lighter() or Qt.tint() functions:

Rectangle { color: Qt.rgba(0.5, 0.5, 0, 1) }

See also QML Basic Types.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.