aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2016-10-13 04:09:40 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2016-10-17 17:56:55 +0000
commitd6fbb1239950f392f3d569da7dde226e865b7bcd (patch)
tree1d36f5487053a463143683cefca9bca48c5e0c21
parentb13c94c9fcac1bf8a4761c56776c82292d261827 (diff)
Material: introduce an active and disabled icon colors
https://material.google.com/style/icons.html#icons-system-icons > The standard opacity for an active icon on a light background is 54% (#000000). An inactive icon, which is lower in the visual hierarchy, should have an opacity of 26% (#000000). > The standard opacity for an active icon on a dark background is 100% (#FFFFFF). An inactive icon, which is lower in the visual hierarchy, should have an opacity of 30% (#FFFFFF). Change-Id: I5916855cd0a4005ee55ac781207ac9cf4d078a34 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp14
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h4
2 files changed, 18 insertions, 0 deletions
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 6c6a0e3e..1c19bbd3 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -400,6 +400,10 @@ static const QRgb hintTextColorLight = 0x60000000;
static const QRgb hintTextColorDark = 0x4CFFFFFF;
static const QRgb dividerColorLight = 0x1E000000;
static const QRgb dividerColorDark = 0x1EFFFFFF;
+static const QRgb iconColorLight = 0x89000000;
+static const QRgb iconColorDark = 0xFFFFFFFF;
+static const QRgb iconDisabledColorLight = 0x42000000;
+static const QRgb iconDisabledColorDark = 0x4CFFFFFF;
static const QRgb raisedButtonColorLight = 0xFFD6D7D7;
static const QRgb raisedButtonColorDark = 0x3FCCCCCC;
static const QRgb raisedButtonDisabledColorLight = dividerColorLight;
@@ -863,6 +867,16 @@ QColor QQuickMaterialStyle::dividerColor() const
return QColor::fromRgba(m_theme == Light ? dividerColorLight : dividerColorDark);
}
+QColor QQuickMaterialStyle::iconColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? iconColorLight : iconColorDark);
+}
+
+QColor QQuickMaterialStyle::iconDisabledColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? iconDisabledColorLight : iconDisabledColorDark);
+}
+
QColor QQuickMaterialStyle::buttonColor(bool highlighted, bool pressed, bool hover) const
{
Shade shade = pressed ? (m_theme == Light ? Shade700 : Shade100)
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 6a841803..af5638f1 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -74,6 +74,8 @@ class QQuickMaterialStyle : public QQuickStyleAttached
Q_PROPERTY(QColor textSelectionColor READ textSelectionColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dropShadowColor READ dropShadowColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dividerColor READ dividerColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor iconColor READ iconColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor iconDisabledColor READ iconDisabledColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor buttonPressColor READ buttonPressColor NOTIFY paletteChanged FINAL)
@@ -201,6 +203,8 @@ public:
QColor textSelectionColor() const;
QColor dropShadowColor() const;
QColor dividerColor() const;
+ QColor iconColor() const;
+ QColor iconDisabledColor() const;
QColor buttonColor() const;
QColor buttonHoverColor() const;
QColor buttonPressColor() const;