highlight/highlightedText from proper color group

lately the highlight color of plasma became a very
washed-out blue, (since it switched to use the
global system colors) that was because it actually
taken the highlight color (and highlightedText)
from the wrong source.
there is a correct color group in kcolorscheme for
that, that is Selection, take those two colors
from that (also means highlight and highlightedtext
always be the same in all plasma::theme::colorgroups
but that's not a problem)

update test to reflect that

REVIEW:127842
This commit is contained in:
Marco Martin 2016-05-05 12:21:03 +02:00
parent f336f80039
commit f0c119696d
4 changed files with 12 additions and 10 deletions

View File

@ -118,7 +118,7 @@ void ThemeTest::testColors()
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
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), QColor(252,252,252));
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::NormalColorGroup), QColor(17,209,22)); Plasma::Theme::NormalColorGroup), QColor(17,209,22));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
@ -141,7 +141,7 @@ void ThemeTest::testColors()
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
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), QColor(252,252,252));
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::ButtonColorGroup), QColor(17,209,23)); Plasma::Theme::ButtonColorGroup), QColor(17,209,23));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
@ -164,7 +164,7 @@ void ThemeTest::testColors()
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
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), QColor(252,252,252));
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::ViewColorGroup), QColor(17,209,24)); Plasma::Theme::ViewColorGroup), QColor(17,209,24));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
@ -177,7 +177,7 @@ void ThemeTest::testColors()
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor, QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
Plasma::Theme::ComplementaryColorGroup), QColor(49,54,59)); Plasma::Theme::ComplementaryColorGroup), QColor(49,54,59));
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor, QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230)); Plasma::Theme::ComplementaryColorGroup), QColor(61,174,230));
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor, QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230)); Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor, QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
@ -187,7 +187,7 @@ void ThemeTest::testColors()
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
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), QColor(252,252,252));
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
Plasma::Theme::ComplementaryColorGroup), QColor(17,209,25)); Plasma::Theme::ComplementaryColorGroup), QColor(17,209,25));
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,

View File

@ -61,7 +61,6 @@ class QuickTheme : public Plasma::Theme
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 buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy)
@ -70,7 +69,6 @@ class QuickTheme : public Plasma::Theme
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 buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy)
@ -79,7 +77,6 @@ class QuickTheme : public Plasma::Theme
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 buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy)
Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy) Q_PROPERTY(QColor buttonNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy)

View File

@ -53,6 +53,7 @@ QHash<QString, QAtomicInt> ThemePrivate::themesRefCount = QHash<QString, QAtomic
ThemePrivate::ThemePrivate(QObject *parent) ThemePrivate::ThemePrivate(QObject *parent)
: QObject(parent), : QObject(parent),
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)), colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
selectionColorScheme(QPalette::Active, KColorScheme::Selection, KSharedConfigPtr(0)),
buttonColorScheme(QPalette::Active, KColorScheme::Button, KSharedConfigPtr(0)), buttonColorScheme(QPalette::Active, KColorScheme::Button, KSharedConfigPtr(0)),
viewColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)), viewColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)),
complementaryColorScheme(QPalette::Active, KColorScheme::Complementary, KSharedConfigPtr(0)), complementaryColorScheme(QPalette::Active, KColorScheme::Complementary, KSharedConfigPtr(0)),
@ -654,10 +655,12 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
case Theme::BackgroundColor: case Theme::BackgroundColor:
return scheme->background(KColorScheme::NormalBackground).color(); return scheme->background(KColorScheme::NormalBackground).color();
case Theme::HighlightColor:
case Theme::HoverColor: case Theme::HoverColor:
return scheme->decoration(KColorScheme::HoverColor).color(); return scheme->decoration(KColorScheme::HoverColor).color();
case Theme::HighlightColor:
return selectionColorScheme.background(KColorScheme::NormalBackground).color();
case Theme::FocusColor: case Theme::FocusColor:
return scheme->decoration(KColorScheme::FocusColor).color(); return scheme->decoration(KColorScheme::FocusColor).color();
@ -668,7 +671,7 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
return scheme->foreground(KColorScheme::VisitedText).color(); return scheme->foreground(KColorScheme::VisitedText).color();
case Theme::HighlightedTextColor: case Theme::HighlightedTextColor:
return scheme->shade(scheme->decoration(KColorScheme::HoverColor).color(), KColorScheme::LightShade, 1); return selectionColorScheme.foreground(KColorScheme::NormalText).color();
case Theme::PositiveTextColor: case Theme::PositiveTextColor:
return scheme->foreground(KColorScheme::PositiveText).color(); return scheme->foreground(KColorScheme::PositiveText).color();
@ -783,6 +786,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
} }
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors); colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
selectionColorScheme = KColorScheme(QPalette::Active, KColorScheme::Selection, colors);
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors); buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors); viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
complementaryColorScheme = KColorScheme(QPalette::Active, KColorScheme::Complementary, colors); complementaryColorScheme = KColorScheme(QPalette::Active, KColorScheme::Complementary, colors);

View File

@ -115,6 +115,7 @@ public:
QList<QString> fallbackThemes; QList<QString> fallbackThemes;
KSharedConfigPtr colors; KSharedConfigPtr colors;
KColorScheme colorScheme; KColorScheme colorScheme;
KColorScheme selectionColorScheme;
KColorScheme buttonColorScheme; KColorScheme buttonColorScheme;
KColorScheme viewColorScheme; KColorScheme viewColorScheme;
KColorScheme complementaryColorScheme; KColorScheme complementaryColorScheme;