add Positive, Neutral, Negative text colors

add named colors for positive (usually green)
neutral(usually yellow) negative(usually red)
foreground objects, such as text or parts of
svg icons/themes

REVIEW:127696
Change-Id: I646306339f1684cdc062da3d3af1489af6092372
This commit is contained in:
Marco Martin 2016-04-20 13:05:24 +02:00
parent 9f1b9e7af5
commit 1cf145861b
8 changed files with 272 additions and 11 deletions

View File

@ -26,10 +26,10 @@ DecorationHover=61,174,230
ForegroundActive=246,116,0 ForegroundActive=246,116,0
ForegroundInactive=175,176,179 ForegroundInactive=175,176,179
ForegroundLink=61,174,230 ForegroundLink=61,174,230
ForegroundNegative=237,21,21 ForegroundNegative=237,21,22
ForegroundNeutral=201,206,59 ForegroundNeutral=201,206,60
ForegroundNormal=49,54,59 ForegroundNormal=49,54,59
ForegroundPositive=17,209,22 ForegroundPositive=17,209,23
ForegroundVisited=61,174,230 ForegroundVisited=61,174,230
[Colors:Selection] [Colors:Selection]
@ -68,10 +68,10 @@ DecorationHover=61,174,230
ForegroundActive=246,116,0 ForegroundActive=246,116,0
ForegroundInactive=175,176,179 ForegroundInactive=175,176,179
ForegroundLink=61,174,230 ForegroundLink=61,174,230
ForegroundNegative=237,21,21 ForegroundNegative=237,21,23
ForegroundNeutral=201,206,59 ForegroundNeutral=201,206,61
ForegroundNormal=49,54,59 ForegroundNormal=49,54,59
ForegroundPositive=17,209,22 ForegroundPositive=17,209,24
ForegroundVisited=61,174,230 ForegroundVisited=61,174,230
[Colors:Window] [Colors:Window]
@ -96,13 +96,12 @@ DecorationHover=71,174,230
ForegroundActive=246,116,20 ForegroundActive=246,116,20
ForegroundInactive=185,176,179 ForegroundInactive=185,176,179
ForegroundLink=71,174,230 ForegroundLink=71,174,230
ForegroundNegative=247,21,21 ForegroundNegative=237,21,24
ForegroundNeutral=201,206,69 ForegroundNeutral=201,206,62
ForegroundNormal=239,240,241 ForegroundNormal=239,240,241
ForegroundPositive=27,209,22 ForegroundPositive=17,209,25
ForegroundVisited=71,174,230 ForegroundVisited=71,174,230
[General] [General]
ColorScheme=Breeze ColorScheme=Breeze
Name=Breeze Name=Breeze

View File

@ -114,6 +114,12 @@ void ThemeTest::testColors()
Plasma::Theme::NormalColorGroup), QColor(61,174,230)); Plasma::Theme::NormalColorGroup), QColor(61,174,230));
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
Plasma::Theme::NormalColorGroup).name(), QColor(163,214,251).name()); Plasma::Theme::NormalColorGroup).name(), QColor(163,214,251).name());
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::NormalColorGroup), QColor(17,209,22));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
Plasma::Theme::NormalColorGroup), QColor(201,206,59));
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
Plasma::Theme::NormalColorGroup), QColor(237,21,21));
QCOMPARE(m_theme->color(Plasma::Theme::TextColor, QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
Plasma::Theme::ButtonColorGroup), QColor(49,54,59)); Plasma::Theme::ButtonColorGroup), QColor(49,54,59));
@ -131,6 +137,12 @@ void ThemeTest::testColors()
Plasma::Theme::ButtonColorGroup), QColor(61,174,230)); Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
Plasma::Theme::ButtonColorGroup).name(), QColor(163,214,251).name()); Plasma::Theme::ButtonColorGroup).name(), QColor(163,214,251).name());
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::ButtonColorGroup), QColor(17,209,23));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
Plasma::Theme::ButtonColorGroup), QColor(201,206,60));
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
Plasma::Theme::ButtonColorGroup), QColor(237,21,22));
QCOMPARE(m_theme->color(Plasma::Theme::TextColor, QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
Plasma::Theme::ViewColorGroup), QColor(49,54,59)); Plasma::Theme::ViewColorGroup), QColor(49,54,59));
@ -148,6 +160,12 @@ void ThemeTest::testColors()
Plasma::Theme::ViewColorGroup), QColor(61,174,230)); Plasma::Theme::ViewColorGroup), QColor(61,174,230));
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
Plasma::Theme::ViewColorGroup).name(), QColor(163,214,251).name()); Plasma::Theme::ViewColorGroup).name(), QColor(163,214,251).name());
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::ViewColorGroup), QColor(17,209,24));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
Plasma::Theme::ViewColorGroup), QColor(201,206,61));
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
Plasma::Theme::ViewColorGroup), QColor(237,21,23));
QCOMPARE(m_theme->color(Plasma::Theme::TextColor, QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
Plasma::Theme::ComplementaryColorGroup), QColor(239,240,241)); Plasma::Theme::ComplementaryColorGroup), QColor(239,240,241));
@ -165,6 +183,12 @@ void ThemeTest::testColors()
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230)); Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
Plasma::Theme::ComplementaryColorGroup).name(), QColor(169,214,249).name()); Plasma::Theme::ComplementaryColorGroup).name(), QColor(169,214,249).name());
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::ComplementaryColorGroup), QColor(17,209,25));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
Plasma::Theme::ComplementaryColorGroup), QColor(201,206,62));
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
Plasma::Theme::ComplementaryColorGroup), QColor(237,21,24));
} }

View File

@ -176,6 +176,39 @@ QColor ColorScope::backgroundColor() const
return m_theme.color(Plasma::Theme::BackgroundColor, m_group); return m_theme.color(Plasma::Theme::BackgroundColor, m_group);
} }
QColor ColorScope::positiveTextColor() const
{
if (m_inherit) {
ColorScope *s = findParentScope();
if (s) {
return s->positiveTextColor();
}
}
return m_theme.color(Plasma::Theme::PositiveTextColor, m_group);
}
QColor ColorScope::neutralTextColor() const
{
if (m_inherit) {
ColorScope *s = findParentScope();
if (s) {
return s->neutralTextColor();
}
}
return m_theme.color(Plasma::Theme::NeutralTextColor, m_group);
}
QColor ColorScope::negativeTextColor() const
{
if (m_inherit) {
ColorScope *s = findParentScope();
if (s) {
return s->negativeTextColor();
}
}
return m_theme.color(Plasma::Theme::NegativeTextColor, m_group);
}
void ColorScope::itemChange(ItemChange change, const ItemChangeData &value) void ColorScope::itemChange(ItemChange change, const ItemChangeData &value)
{ {
if (change == QQuickItem::ItemSceneChange) { if (change == QQuickItem::ItemSceneChange) {

View File

@ -64,6 +64,21 @@ class ColorScope : public QQuickItem
*/ */
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY colorsChanged) Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY colorsChanged)
/**
* Color of foreground objects with a "positive message" connotation (usually green)
*/
Q_PROPERTY(QColor positiveTextColor READ positiveTextColor NOTIFY colorsChanged)
/**
* Color of foreground objects with a "neutral message" connotation (usually yellow)
*/
Q_PROPERTY(QColor neutralTextColor READ neutralTextColor NOTIFY colorsChanged)
/**
* Color of foreground objects with a "negative message" connotation (usually red)
*/
Q_PROPERTY(QColor negativeTextColor READ negativeTextColor NOTIFY colorsChanged)
public: public:
/// @cond INTERNAL_DOCS /// @cond INTERNAL_DOCS
ColorScope(QQuickItem *parent = 0, QObject *parentObject = 0); ColorScope(QQuickItem *parent = 0, QObject *parentObject = 0);
@ -76,6 +91,9 @@ public:
QColor highlightColor() const; QColor highlightColor() const;
QColor highlightedTextColor() const; QColor highlightedTextColor() const;
QColor backgroundColor() const; QColor backgroundColor() const;
QColor positiveTextColor() const;
QColor neutralTextColor() const;
QColor negativeTextColor() const;
////NEEDED BY QML TO CREATE ATTACHED PROPERTIES ////NEEDED BY QML TO CREATE ATTACHED PROPERTIES
static ColorScope *qmlAttachedProperties(QObject *object); static ColorScope *qmlAttachedProperties(QObject *object);

View File

@ -49,6 +49,21 @@ QColor QuickTheme::highlightedTextColor() const
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor); return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor);
} }
QColor QuickTheme::positiveTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor);
}
QColor QuickTheme::neutralTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor);
}
QColor QuickTheme::negativeTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor);
}
QColor QuickTheme::backgroundColor() const QColor QuickTheme::backgroundColor() const
{ {
return Plasma::Theme::color(Plasma::Theme::BackgroundColor); return Plasma::Theme::color(Plasma::Theme::BackgroundColor);
@ -64,6 +79,21 @@ QColor QuickTheme::buttonBackgroundColor() const
return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ButtonColorGroup); return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ButtonColorGroup);
} }
QColor QuickTheme::buttonPositiveTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ButtonColorGroup);
}
QColor QuickTheme::buttonNeutralTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ButtonColorGroup);
}
QColor QuickTheme::buttonNegativeTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ButtonColorGroup);
}
QColor QuickTheme::linkColor() const QColor QuickTheme::linkColor() const
{ {
return Plasma::Theme::color(Plasma::Theme::LinkColor); return Plasma::Theme::color(Plasma::Theme::LinkColor);
@ -114,6 +144,21 @@ QColor QuickTheme::viewHighlightedTextColor() const
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ViewColorGroup); return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ViewColorGroup);
} }
QColor QuickTheme::viewPositiveTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup);
}
QColor QuickTheme::viewNeutralTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup);
}
QColor QuickTheme::viewNegativeTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup);
}
QColor QuickTheme::complementaryTextColor() const QColor QuickTheme::complementaryTextColor() const
{ {
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup); return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup);
@ -139,6 +184,21 @@ QColor QuickTheme::complementaryHighlightedTextColor() const
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ComplementaryColorGroup); return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ComplementaryColorGroup);
} }
QColor QuickTheme::complementaryPositiveTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup);
}
QColor QuickTheme::complementaryNeutralTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup);
}
QColor QuickTheme::complementaryNegativeTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup);
}
} }
#include "moc_quicktheme.cpp" #include "moc_quicktheme.cpp"

View File

@ -53,24 +53,36 @@ class QuickTheme : public Plasma::Theme
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor linkColor READ linkColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor linkColor READ linkColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor positiveTextColor READ positiveTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor neutralTextColor READ neutralTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor negativeTextColor READ negativeTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonHighlightedTextColor READ buttonHighlightedTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonHighlightedTextColor READ buttonHighlightedTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor viewHighlightedTextColor READ viewHighlightedTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor viewHighlightedTextColor READ viewHighlightedTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor complementaryTextColor READ complementaryTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor complementaryTextColor READ complementaryTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor complementaryBackgroundColor READ complementaryBackgroundColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor complementaryBackgroundColor READ complementaryBackgroundColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor complementaryHoverColor READ viewHoverColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor complementaryHoverColor READ viewHoverColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor complementaryFocusColor READ viewFocusColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor complementaryFocusColor READ viewFocusColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor complementaryHighlightedTextColor READ complementaryHighlightedTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor complementaryHighlightedTextColor READ complementaryHighlightedTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy)
public: public:
explicit QuickTheme(QObject *parent = 0); explicit QuickTheme(QObject *parent = 0);
@ -96,6 +108,24 @@ public:
*/ */
QColor highlightedTextColor() const; QColor highlightedTextColor() const;
/**
* @return The theme's colorscheme's positive text color
* @since 5.22
*/
QColor positiveTextColor() const;
/**
* @return The theme's colorscheme's neutral text color
* @since 5.22
*/
QColor neutralTextColor() const;
/**
* @return The theme's colorscheme's negative text color
* @since 5.22
*/
QColor negativeTextColor() const;
/** /**
* @return The theme's colorscheme's background color * @return The theme's colorscheme's background color
* @since 5.0 * @since 5.0
@ -114,6 +144,24 @@ public:
*/ */
QColor buttonBackgroundColor() const; QColor buttonBackgroundColor() const;
/**
* @return The theme's colorscheme's positive text color of buttons
* @since 5.22
*/
QColor buttonPositiveTextColor() const;
/**
* @return The theme's colorscheme's neutral text color of buttons
* @since 5.22
*/
QColor buttonNeutralTextColor() const;
/**
* @return The theme's colorscheme's negative text color of buttons
* @since 5.22
*/
QColor buttonNegativeTextColor() const;
/** /**
* @return The theme's colorscheme's link color * @return The theme's colorscheme's link color
* @since 5.0 * @since 5.0
@ -174,6 +222,24 @@ public:
*/ */
QColor viewHighlightedTextColor() const; QColor viewHighlightedTextColor() const;
/**
* @return The theme's colorscheme's positive text color of view
* @since 5.22
*/
QColor viewPositiveTextColor() const;
/**
* @return The theme's colorscheme's neutral text color of view
* @since 5.22
*/
QColor viewNeutralTextColor() const;
/**
* @return The theme's colorscheme's negative text color of view
* @since 5.22
*/
QColor viewNegativeTextColor() const;
/** /**
* @return The theme's colorscheme's text color of "complementary" areas * @return The theme's colorscheme's text color of "complementary" areas
* @since 5.0 * @since 5.0
@ -204,6 +270,24 @@ public:
*/ */
QColor complementaryHighlightedTextColor() const; QColor complementaryHighlightedTextColor() const;
/**
* @return The theme's colorscheme's positive text color of complementary
* @since 5.22
*/
QColor complementaryPositiveTextColor() const;
/**
* @return The theme's colorscheme's neutral text color of complementary
* @since 5.22
*/
QColor complementaryNeutralTextColor() const;
/**
* @return The theme's colorscheme's negative text color of complementary
* @since 5.22
*/
QColor complementaryNegativeTextColor() const;
Q_SIGNALS: Q_SIGNALS:
void themeChangedProxy(); void themeChangedProxy();
}; };

View File

@ -444,24 +444,36 @@ const QString ThemePrivate::processStyleSheet(const QString &css)
elements[QStringLiteral("%activatedlink")] = color(Theme::HighlightColor, Theme::NormalColorGroup).name(); elements[QStringLiteral("%activatedlink")] = color(Theme::HighlightColor, Theme::NormalColorGroup).name();
elements[QStringLiteral("%hoveredlink")] = color(Theme::HighlightColor, Theme::NormalColorGroup).name(); elements[QStringLiteral("%hoveredlink")] = color(Theme::HighlightColor, Theme::NormalColorGroup).name();
elements[QStringLiteral("%link")] = color(Theme::LinkColor, Theme::NormalColorGroup).name(); elements[QStringLiteral("%link")] = color(Theme::LinkColor, Theme::NormalColorGroup).name();
elements[QStringLiteral("%positivetextcolor")] = color(Theme::PositiveTextColor, Theme::NormalColorGroup).name();
elements[QStringLiteral("%neutraltextcolor")] = color(Theme::NeutralTextColor, Theme::NormalColorGroup).name();
elements[QStringLiteral("%negativetextcolor")] = color(Theme::NegativeTextColor, Theme::NormalColorGroup).name();
elements[QStringLiteral("%buttontextcolor")] = color(Theme::TextColor, Theme::ButtonColorGroup).name(); elements[QStringLiteral("%buttontextcolor")] = color(Theme::TextColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%buttonbackgroundcolor")] = color(Theme::BackgroundColor, Theme::ButtonColorGroup).name(); elements[QStringLiteral("%buttonbackgroundcolor")] = color(Theme::BackgroundColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%buttonhovercolor")] = color(Theme::HoverColor, Theme::ButtonColorGroup).name(); elements[QStringLiteral("%buttonhovercolor")] = color(Theme::HoverColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%buttonfocuscolor")] = color(Theme::FocusColor, Theme::ButtonColorGroup).name(); elements[QStringLiteral("%buttonfocuscolor")] = color(Theme::FocusColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%buttonhighlightedtextcolor")] = color(Theme::HighlightedTextColor, Theme::ButtonColorGroup).name(); elements[QStringLiteral("%buttonhighlightedtextcolor")] = color(Theme::HighlightedTextColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%buttonpositivetextcolor")] = color(Theme::PositiveTextColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%buttonneutraltextcolor")] = color(Theme::NeutralTextColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%buttonnegativetextcolor")] = color(Theme::NegativeTextColor, Theme::ButtonColorGroup).name();
elements[QStringLiteral("%viewtextcolor")] = color(Theme::TextColor, Theme::ViewColorGroup).name(); elements[QStringLiteral("%viewtextcolor")] = color(Theme::TextColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%viewbackgroundcolor")] = color(Theme::BackgroundColor, Theme::ViewColorGroup).name(); elements[QStringLiteral("%viewbackgroundcolor")] = color(Theme::BackgroundColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%viewhovercolor")] = color(Theme::HoverColor, Theme::ViewColorGroup).name(); elements[QStringLiteral("%viewhovercolor")] = color(Theme::HoverColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%viewfocuscolor")] = color(Theme::FocusColor, Theme::ViewColorGroup).name(); elements[QStringLiteral("%viewfocuscolor")] = color(Theme::FocusColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%viewhighlightedtextcolor")] = color(Theme::HighlightedTextColor, Theme::ViewColorGroup).name(); elements[QStringLiteral("%viewhighlightedtextcolor")] = color(Theme::HighlightedTextColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%viewpositivetextcolor")] = color(Theme::PositiveTextColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%viewneutraltextcolor")] = color(Theme::NeutralTextColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%viewnegativetextcolor")] = color(Theme::NegativeTextColor, Theme::ViewColorGroup).name();
elements[QStringLiteral("%complementarytextcolor")] = color(Theme::TextColor, Theme::ComplementaryColorGroup).name(); elements[QStringLiteral("%complementarytextcolor")] = color(Theme::TextColor, Theme::ComplementaryColorGroup).name();
elements[QStringLiteral("%complementarybackgroundcolor")] = color(Theme::BackgroundColor, Theme::ComplementaryColorGroup).name(); elements[QStringLiteral("%complementarybackgroundcolor")] = color(Theme::BackgroundColor, Theme::ComplementaryColorGroup).name();
elements[QStringLiteral("%complementaryhovercolor")] = color(Theme::HoverColor, Theme::ComplementaryColorGroup).name(); elements[QStringLiteral("%complementaryhovercolor")] = color(Theme::HoverColor, Theme::ComplementaryColorGroup).name();
elements[QStringLiteral("%complementaryfocuscolor")] = color(Theme::FocusColor, Theme::ComplementaryColorGroup).name(); elements[QStringLiteral("%complementaryfocuscolor")] = color(Theme::FocusColor, Theme::ComplementaryColorGroup).name();
elements[QStringLiteral("%complementaryhighlightedtextcolor")] = color(Theme::TextColor, Theme::ComplementaryColorGroup).name(); elements[QStringLiteral("%complementaryhighlightedtextcolor")] = color(Theme::TextColor, Theme::ComplementaryColorGroup).name();
elements[QStringLiteral("%complementarypositivetextcolor")] = color(Theme::PositiveTextColor, Theme::ComplementaryColorGroup).name();
elements[QStringLiteral("%complementaryneutraltextcolor")] = color(Theme::NeutralTextColor, Theme::ComplementaryColorGroup).name();
elements[QStringLiteral("%complementarynegativetextcolor")] = color(Theme::NegativeTextColor, Theme::ComplementaryColorGroup).name();
QFont font = QGuiApplication::font(); QFont font = QGuiApplication::font();
elements[QStringLiteral("%fontsize")] = QStringLiteral("%1pt").arg(font.pointSize()); elements[QStringLiteral("%fontsize")] = QStringLiteral("%1pt").arg(font.pointSize());
@ -489,6 +501,9 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group)
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%buttonhovercolor")); stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%buttonhovercolor"));
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%buttonhighlightedtextcolor")); stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%buttonhighlightedtextcolor"));
stylesheet += skel.arg(QStringLiteral("PositiveText"), QStringLiteral("%buttonpositivetextcolor"));
stylesheet += skel.arg(QStringLiteral("NeutralText"), QStringLiteral("%buttonneutraltextcolor"));
stylesheet += skel.arg(QStringLiteral("NegativeText"), QStringLiteral("%buttonnegativetextcolor"));
break; break;
case Theme::ViewColorGroup: case Theme::ViewColorGroup:
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%viewtextcolor")); stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%viewtextcolor"));
@ -496,6 +511,9 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group)
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%viewhovercolor")); stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%viewhovercolor"));
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%viewhighlightedtextcolor")); stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%viewhighlightedtextcolor"));
stylesheet += skel.arg(QStringLiteral("PositiveText"), QStringLiteral("%viewpositivetextcolor"));
stylesheet += skel.arg(QStringLiteral("NeutralText"), QStringLiteral("%viewneutraltextcolor"));
stylesheet += skel.arg(QStringLiteral("NegativeText"), QStringLiteral("%viewnegativetextcolor"));
break; break;
case Theme::ComplementaryColorGroup: case Theme::ComplementaryColorGroup:
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%complementarytextcolor")); stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%complementarytextcolor"));
@ -503,6 +521,9 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group)
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%complementaryhovercolor")); stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%complementaryhovercolor"));
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%complementaryhighlightedtextcolor")); stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%complementaryhighlightedtextcolor"));
stylesheet += skel.arg(QStringLiteral("PositiveText"), QStringLiteral("%complementarypositivetextcolor"));
stylesheet += skel.arg(QStringLiteral("NeutralText"), QStringLiteral("%complementaryneutraltextcolor"));
stylesheet += skel.arg(QStringLiteral("NegativeText"), QStringLiteral("%complementarynegativetextcolor"));
break; break;
default: default:
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%textcolor")); stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%textcolor"));
@ -510,6 +531,9 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group)
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%highlightcolor")); stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%highlightcolor"));
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%highlightedtextcolor")); stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%highlightedtextcolor"));
stylesheet += skel.arg(QStringLiteral("PositiveText"), QStringLiteral("%positivetextcolor"));
stylesheet += skel.arg(QStringLiteral("NeutralText"), QStringLiteral("%neutraltextcolor"));
stylesheet += skel.arg(QStringLiteral("NegativeText"), QStringLiteral("%negativetextcolor"));
} }
stylesheet += skel.arg(QStringLiteral("ButtonText"), QStringLiteral("%buttontextcolor")); stylesheet += skel.arg(QStringLiteral("ButtonText"), QStringLiteral("%buttontextcolor"));
@ -517,18 +541,27 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group)
stylesheet += skel.arg(QStringLiteral("ButtonHover"), QStringLiteral("%buttonhovercolor")); stylesheet += skel.arg(QStringLiteral("ButtonHover"), QStringLiteral("%buttonhovercolor"));
stylesheet += skel.arg(QStringLiteral("ButtonFocus"), QStringLiteral("%buttonfocuscolor")); stylesheet += skel.arg(QStringLiteral("ButtonFocus"), QStringLiteral("%buttonfocuscolor"));
stylesheet += skel.arg(QStringLiteral("ButtonHighlightedText"), QStringLiteral("%buttonhighlightedtextcolor")); stylesheet += skel.arg(QStringLiteral("ButtonHighlightedText"), QStringLiteral("%buttonhighlightedtextcolor"));
stylesheet += skel.arg(QStringLiteral("ButtonPositiveText"), QStringLiteral("%buttonpositivetextcolor"));
stylesheet += skel.arg(QStringLiteral("ButtonNeutralText"), QStringLiteral("%buttonneutraltextcolor"));
stylesheet += skel.arg(QStringLiteral("ButtonNegativeText"), QStringLiteral("%buttonnegativetextcolor"));
stylesheet += skel.arg(QStringLiteral("ViewText"), QStringLiteral("%viewtextcolor")); stylesheet += skel.arg(QStringLiteral("ViewText"), QStringLiteral("%viewtextcolor"));
stylesheet += skel.arg(QStringLiteral("ViewBackground"), QStringLiteral("%viewbackgroundcolor")); stylesheet += skel.arg(QStringLiteral("ViewBackground"), QStringLiteral("%viewbackgroundcolor"));
stylesheet += skel.arg(QStringLiteral("ViewHover"), QStringLiteral("%viewhovercolor")); stylesheet += skel.arg(QStringLiteral("ViewHover"), QStringLiteral("%viewhovercolor"));
stylesheet += skel.arg(QStringLiteral("ViewFocus"), QStringLiteral("%viewfocuscolor")); stylesheet += skel.arg(QStringLiteral("ViewFocus"), QStringLiteral("%viewfocuscolor"));
stylesheet += skel.arg(QStringLiteral("ViewHighlightedText"), QStringLiteral("%viewhighlightedtextcolor")); stylesheet += skel.arg(QStringLiteral("ViewHighlightedText"), QStringLiteral("%viewhighlightedtextcolor"));
stylesheet += skel.arg(QStringLiteral("ViewPositiveText"), QStringLiteral("%viewpositivetextcolor"));
stylesheet += skel.arg(QStringLiteral("ViewNeutralText"), QStringLiteral("%viewneutraltextcolor"));
stylesheet += skel.arg(QStringLiteral("ViewNegativeText"), QStringLiteral("%viewnegativetextcolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryText"), QStringLiteral("%complementarytextcolor")); stylesheet += skel.arg(QStringLiteral("ComplementaryText"), QStringLiteral("%complementarytextcolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryBackground"), QStringLiteral("%complementarybackgroundcolor")); stylesheet += skel.arg(QStringLiteral("ComplementaryBackground"), QStringLiteral("%complementarybackgroundcolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryHover"), QStringLiteral("%complementaryhovercolor")); stylesheet += skel.arg(QStringLiteral("ComplementaryHover"), QStringLiteral("%complementaryhovercolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryFocus"), QStringLiteral("%complementaryfocuscolor")); stylesheet += skel.arg(QStringLiteral("ComplementaryFocus"), QStringLiteral("%complementaryfocuscolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryHighlightedText"), QStringLiteral("%complementaryhighlightedtextcolor")); stylesheet += skel.arg(QStringLiteral("ComplementaryHighlightedText"), QStringLiteral("%complementaryhighlightedtextcolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryPositiveText"), QStringLiteral("%complementarypositivetextcolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryNeutralText"), QStringLiteral("%complementaryneutraltextcolor"));
stylesheet += skel.arg(QStringLiteral("ComplementaryNegativeText"), QStringLiteral("%complementarynegativetextcolor"));
stylesheet = processStyleSheet(stylesheet); stylesheet = processStyleSheet(stylesheet);
cachedSvgStyleSheets.insert(group, stylesheet); cachedSvgStyleSheets.insert(group, stylesheet);
@ -636,6 +669,13 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
case Theme::HighlightedTextColor: case Theme::HighlightedTextColor:
return scheme->shade(scheme->decoration(KColorScheme::HoverColor).color(), KColorScheme::LightShade, 1); return scheme->shade(scheme->decoration(KColorScheme::HoverColor).color(), KColorScheme::LightShade, 1);
case Theme::PositiveTextColor:
return scheme->foreground(KColorScheme::PositiveText).color();
case Theme::NeutralTextColor:
return scheme->foreground(KColorScheme::NeutralText).color();
case Theme::NegativeTextColor:
return scheme->foreground(KColorScheme::NegativeText).color();
} }
return QColor(); return QColor();

View File

@ -75,7 +75,10 @@ public:
FocusColor = 4, /** color for focus effect on view */ FocusColor = 4, /** color for focus effect on view */
LinkColor = 5, /** color for clickable links */ LinkColor = 5, /** color for clickable links */
VisitedLinkColor = 6, /** color visited clickable links */ VisitedLinkColor = 6, /** color visited clickable links */
HighlightedTextColor = 7/** color contrasting with HighlightColor, to be used for instance with */ HighlightedTextColor = 7,/** color contrasting with HighlightColor, to be used for instance with */
PositiveTextColor = 8, /** color of foreground objects with a "positive message" connotation (usually green) */
NeutralTextColor = 9, /** color of foreground objects with a "neutral message" connotation (usually yellow) */
NegativeTextColor = 10 /** color of foreground objects with a "negative message" connotation (usually red) */
}; };
enum ColorGroup { enum ColorGroup {