I would like to do something like this:
Item {
property color primary_color
Rectangle {
color: Qt.rgba(primary_color.red/2, primary_color.green, primary_color.blue, primary_color.alpha<0.5?0.25:0.75)
}
}
but how can I acces the properties?
From http://doc.qt.io/qt-5/qml-color.html documentation:
A color type has r, g, b and a properties that refer to the red, green, blue and alpha values of the color, respectively. Additionally it has hsvHue, hsvSaturation, hsvValue and hslHue, hslSaturation, hslLightness properties, which allow access to color values in HSV and HSL color models accordingly:
Item {
property color primary_color
Rectangle {
color: Qt.rgba(primary_color.r/2, primary_color.g, primary_color.b, primary_color.a<0.5?0.25:0.75)
}
}