color QML Value Type
Un valor de color ARGB. Más...
Propiedades
- a : real
- b : real
- g : real
- hslHue : real
- hslLightness : real
- hslSaturation : real
- hsvHue : real
- hsvSaturation : real
- hsvValue : real
- r : real
- valid : bool
Descripción detallada
El tipo color se refiere a un valor de color ARGB. Puede especificarse de varias maneras:
- Mediante un SVG color name, como "red", "green" o "lightsteelblue".
- Mediante un triplete o cuádruple hexadecimal de la forma
"#RRGGBB"y"#AARRGGBB"respectivamente. Por ejemplo, el color rojo corresponde a un triplete de"#FF0000"y un azul ligeramente transparente a un cuadrado de"#800000FF". - Mediante las funciones Qt.rgba(), Qt.hsva(), Qt.hsla(), Qt.darker(), Qt.lighter() o Qt.tint().
Ejemplo:

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 }
Un tipo de color tiene las propiedades r, g, b y a que se refieren a los valores rojo, verde, azul y alfa del color, respectivamente. Además, las propiedades hsvHue, hsvSaturation, hsvValue, hslHue, hslSaturation y hslLightness permiten acceder a los valores de color en los modelos de color HSV y HSL respectivamente.
Text { color: "red" // prints "1 0 0 1" Component.onCompleted: console.log(color.r, color.g, color.b, color.a) }
Para comprobar la igualdad de los valores de color, utilice la función Qt.colorEqual(). Esto permite que los colores se comparen con precisión tanto si están en forma de propiedad como en cualquiera de las formas de especificación de cadena aceptables.
Cuando se integre con C++, tenga en cuenta que cualquier valor QColor pasado a QML desde C++ se convierte automáticamente en un valor color, y viceversa.
Este tipo de valor lo proporciona la importación QtQuick.
Referencia de colores SVG
En la tabla siguiente se enumeran los colores SVG disponibles:
| Nombre | Hex | Color |
|---|---|---|
| aliceblue | #f0f8ff | |
| antiquewhite | #faebd7 | |
| aqua | #00ffff | |
| aguamarina | #7fffd4 | |
| azure | #f0ffff | |
| beige | #f5f5dc | |
| bizcocho | #ffe4c4 | |
| negro | #000000 | |
| blanchedalmond | #ffebcd | |
| azul | #0000ff | |
| azulvioleta | #8a2be2 | |
| marrón | #a52a2a | |
| burlywood | #deb887 | |
| cadetblue | #5f9ea0 | |
| chartreuse | #7fff00 | |
| chocolate | #d2691e | |
| coral | #ff7f50 | |
| azul aciano | #6495ed | |
| cornsilk | #fff8dc | |
| carmesí | #dc143c | |
| cian | #00ffff | |
| azul oscuro | #00008b | |
| darkcyan | #008b8b | |
| darkgoldenrod | #b8860b | |
| darkgray | #a9a9a9 | |
| darkgreen | #006400 | |
| darkgrey | #a9a9a9 | |
| darkkhaki | #bdb76b | |
| darkmagenta | #8b008b | |
| darkolivegreen | #556b2f | |
| darkorange | #ff8c00 | |
| darkorchid | #9932cc | |
| darkred | #8b0000 | |
| darkalmon | #e9967a | |
| darkseagreen | #8fbc8f | |
| darkslateblue | #483d8b | |
| darkslategray | #2f4f4f | |
| darkslategrey | #2f4f4f | |
| darkturquoise | #00ced1 | |
| darkviolet | #9400d3 | |
| deeppink | #ff1493 | |
| deepskyblue | #00bfff | |
| dimgray | #696969 | |
| dimgrey | #696969 | |
| dodgerblue | #1e90ff | |
| ladrillo refractario | #b22222 | |
| floralwhite | #fffaf0 | |
| forestgreen | #228b22 | |
| fucsia | #ff00ff | |
| gainsboro | #dcdcdc | |
| ghostwhite | #f8f8ff | |
| oro | #ffd700 | |
| goldenrod | #daa520 | |
| gris | #808080 | |
| gris | #808080 | |
| verde | #008000 | |
| verdeamarillo | #adff2f | |
| honeydew | #f0fff0 | |
| rosa vivo | #ff69b4 | |
| rojo indio | #cd5c5c | |
| índigo | #4b0082 | |
| ivory | #fffff0 | |
| caqui | #f0e68c | |
| lavanda | #e6e6fa | |
| colorete lavanda | #fff0f5 | |
| lawngreen | #7cfc00 | |
| lemonchiffon | #fffacd | |
| lightblue | #add8e6 | |
| lightcoral | #f08080 | |
| lightcyan | #e0ffff | |
| lightgoldenrodyellow | #fafad2 | |
| lightgray | #d3d3d3 | |
| verde claro | #90ee90 | |
| gris claro | #d3d3d3 | |
| rosa claro | #ffb6c1 | |
| salmón claro | #ffa07a | |
| lightseagreen | #20b2aa | |
| lightskyblue | #87cefa | |
| lightslategray | #778899 | |
| lightslategrey | #778899 | |
| lightsteelblue | #b0c4de | |
| lightyellow | #ffffe0 | |
| lima | #00ff00 | |
| verde lima | #32cd32 | |
| lino | #faf0e6 | |
| magenta | #ff00ff | |
| granate | #800000 | |
| aguamarina medio | #66cdaa | |
| azul medio | #0000cd | |
| mediumorchid | #ba55d3 | |
| mediumpurple | #9370db | |
| mediumseagreen | #3cb371 | |
| mediumslateblue | #7b68ee | |
| mediumspringgreen | #00fa9a | |
| mediumturquoise | #48d1cc | |
| mediumvioletred | #c71585 | |
| midnightblue | #191970 | |
| mintcream | #f5fffa | |
| mistyrose | #ffe4e1 | |
| mocasín | #ffe4b5 | |
| navajowhite | #ffdead | |
| navy | #000080 | |
| oldlace | #fdf5e6 | |
| olive | #808000 | |
| olivedrab | #6b8e23 | |
| naranja | #ffa500 | |
| naranja | #ff4500 | |
| orquídea | #da70d6 | |
| palegoldenrod | #eee8aa | |
| palegreen | #98fb98 | |
| paleturquoise | #afeeee | |
| palvioletred | #db7093 | |
| papayawhip | #ffefd5 | |
| peachpuff | #ffdab9 | |
| peru | #cd853f | |
| rosa | #ffc0cb | |
| ciruela | #dda0dd | |
| powderblue | #b0e0e6 | |
| púrpura | #800080 | |
| rojo | #ff0000 | |
| marrón rosado | #bc8f8f | |
| royalblue | #4169e1 | |
| saddlebrown | #8b4513 | |
| salmón | #fa8072 | |
| marrón arena | #f4a460 | |
| verde mar | #2e8b57 | |
| seashell | #fff5ee | |
| sienna | #a0522d | |
| plata | #c0c0c0 | |
| azul cielo | #87ceeb | |
| slateblue | #6a5acd | |
| slategray | #708090 | |
| gris pizarra | #708090 | |
| nieve | #fffafa | |
| springgreen | #00ff7f | |
| azul acero | #4682b4 | |
| bronceado | #d2b48c | |
| cerceta | #008080 | |
| cardo | #d8bfd8 | |
| tomate | #ff6347 | |
| turquesa | #40e0d0 | |
| violeta | #ee82ee | |
| trigo | #f5deb3 | |
| blanco | #ffffff | |
| humo blanco | #f5f5f5 | |
| amarillo | #ffff00 | |
| amarilloverde | #9acd32 |
Véase también Tipos de valor QML.
Documentación de propiedades
a : real
El canal de color Alfa del modelo RGBA. Alfa representa la opacidad de cada píxel.
b : real
El canal de color Azul del modelo RGBA.
g : real
El canal de color Verde del modelo RGBA.
hslHue : real
El componente de color HSL hue del color.
hslLightness : real
El componente de color HSL Luminosidad del color.
hslSaturation : real
El componente de color HSL Saturación del color.
hsvHue : real
El componente de color HSV Hue del color.
hsvSaturation : real
El componente de color HSV Saturación del color.
hsvValue : real
El componente de color HSV Value del color.
r : real
El canal de color Rojo del modelo RGBA.
valid : bool
Devuelve True si el color es válido; en caso contrario devuelve False.
© 2026 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.