bind highlightedText color in Plasma::Theme
we have a color in the Plasma theme "highlight" that is basically an accent color used around.. but one of the uses is to use it as a background, such as highlighted text. in that case we don't know what color would be safe for contrasting on top of it for things like the highlighted text color (plasma style used the background color for that, which is incorrect) REVIEW:127637
This commit is contained in:
parent
9f48b41507
commit
553a9bfe53
120
autotests/data/plasma/desktoptheme/testtheme/colors
Normal file
120
autotests/data/plasma/desktoptheme/testtheme/colors
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
[ColorEffects:Disabled]
|
||||||
|
Color=56,56,56
|
||||||
|
ColorAmount=0
|
||||||
|
ColorEffect=0
|
||||||
|
ContrastAmount=0.65
|
||||||
|
ContrastEffect=1
|
||||||
|
IntensityAmount=0.1
|
||||||
|
IntensityEffect=2
|
||||||
|
|
||||||
|
[ColorEffects:Inactive]
|
||||||
|
ChangeSelectionColor=true
|
||||||
|
Color=112,111,110
|
||||||
|
ColorAmount=0.025
|
||||||
|
ColorEffect=2
|
||||||
|
ContrastAmount=0.1
|
||||||
|
ContrastEffect=2
|
||||||
|
Enable=false
|
||||||
|
IntensityAmount=0
|
||||||
|
IntensityEffect=0
|
||||||
|
|
||||||
|
[Colors:Button]
|
||||||
|
BackgroundAlternate=224,223,222
|
||||||
|
BackgroundNormal=239,240,241
|
||||||
|
DecorationFocus=30,146,255
|
||||||
|
DecorationHover=61,174,230
|
||||||
|
ForegroundActive=246,116,0
|
||||||
|
ForegroundInactive=175,176,179
|
||||||
|
ForegroundLink=61,174,230
|
||||||
|
ForegroundNegative=237,21,21
|
||||||
|
ForegroundNeutral=201,206,59
|
||||||
|
ForegroundNormal=49,54,59
|
||||||
|
ForegroundPositive=17,209,22
|
||||||
|
ForegroundVisited=61,174,230
|
||||||
|
|
||||||
|
[Colors:Selection]
|
||||||
|
BackgroundAlternate=48,138,183
|
||||||
|
BackgroundNormal=61,174,230
|
||||||
|
DecorationFocus=30,146,255
|
||||||
|
DecorationHover=61,174,230
|
||||||
|
ForegroundActive=246,116,0
|
||||||
|
ForegroundInactive=146,204,230
|
||||||
|
ForegroundLink=252,252,252
|
||||||
|
ForegroundNegative=237,21,21
|
||||||
|
ForegroundNeutral=201,206,59
|
||||||
|
ForegroundNormal=252,252,252
|
||||||
|
ForegroundPositive=17,209,22
|
||||||
|
ForegroundVisited=252,252,252
|
||||||
|
|
||||||
|
[Colors:Tooltip]
|
||||||
|
BackgroundAlternate=196,224,255
|
||||||
|
BackgroundNormal=239,240,241
|
||||||
|
DecorationFocus=30,146,255
|
||||||
|
DecorationHover=61,174,230
|
||||||
|
ForegroundActive=246,116,0
|
||||||
|
ForegroundInactive=175,176,179
|
||||||
|
ForegroundLink=61,174,230
|
||||||
|
ForegroundNegative=237,21,21
|
||||||
|
ForegroundNeutral=201,206,59
|
||||||
|
ForegroundNormal=49,54,59
|
||||||
|
ForegroundPositive=17,209,22
|
||||||
|
ForegroundVisited=61,174,230
|
||||||
|
|
||||||
|
[Colors:View]
|
||||||
|
BackgroundAlternate=248,247,246
|
||||||
|
BackgroundNormal=252,252,252
|
||||||
|
DecorationFocus=30,146,255
|
||||||
|
DecorationHover=61,174,230
|
||||||
|
ForegroundActive=246,116,0
|
||||||
|
ForegroundInactive=175,176,179
|
||||||
|
ForegroundLink=61,174,230
|
||||||
|
ForegroundNegative=237,21,21
|
||||||
|
ForegroundNeutral=201,206,59
|
||||||
|
ForegroundNormal=49,54,59
|
||||||
|
ForegroundPositive=17,209,22
|
||||||
|
ForegroundVisited=61,174,230
|
||||||
|
|
||||||
|
[Colors:Window]
|
||||||
|
BackgroundAlternate=218,217,216
|
||||||
|
BackgroundNormal=239,240,241
|
||||||
|
DecorationFocus=30,146,255
|
||||||
|
DecorationHover=61,174,230
|
||||||
|
ForegroundActive=246,116,0
|
||||||
|
ForegroundInactive=175,176,179
|
||||||
|
ForegroundLink=61,174,230
|
||||||
|
ForegroundNegative=237,21,21
|
||||||
|
ForegroundNeutral=201,206,59
|
||||||
|
ForegroundNormal=49,54,59
|
||||||
|
ForegroundPositive=17,209,22
|
||||||
|
ForegroundVisited=61,174,230
|
||||||
|
|
||||||
|
[Colors:Complementary]
|
||||||
|
BackgroundAlternate=59,64,69
|
||||||
|
BackgroundNormal=49,54,59
|
||||||
|
DecorationFocus=40,146,255
|
||||||
|
DecorationHover=71,174,230
|
||||||
|
ForegroundActive=246,116,20
|
||||||
|
ForegroundInactive=185,176,179
|
||||||
|
ForegroundLink=71,174,230
|
||||||
|
ForegroundNegative=247,21,21
|
||||||
|
ForegroundNeutral=201,206,69
|
||||||
|
ForegroundNormal=239,240,241
|
||||||
|
ForegroundPositive=27,209,22
|
||||||
|
ForegroundVisited=71,174,230
|
||||||
|
|
||||||
|
|
||||||
|
[General]
|
||||||
|
ColorScheme=Breeze
|
||||||
|
Name=Breeze
|
||||||
|
shadeSortColumn=true
|
||||||
|
|
||||||
|
[KDE]
|
||||||
|
contrast=7
|
||||||
|
|
||||||
|
[WM]
|
||||||
|
activeBackground=61,174,230
|
||||||
|
activeBlend=252,252,252
|
||||||
|
activeForeground=252,252,252
|
||||||
|
inactiveBackground=123,124,126
|
||||||
|
inactiveBlend=123,124,126
|
||||||
|
inactiveForeground=252,252,252
|
@ -0,0 +1,20 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=Plasma test theme
|
||||||
|
|
||||||
|
|
||||||
|
X-KDE-PluginInfo-Author=KDE Visual Design Group
|
||||||
|
X-KDE-PluginInfo-Email=kde-artists@kde.org
|
||||||
|
X-KDE-PluginInfo-Name=default
|
||||||
|
X-KDE-PluginInfo-Version=5.20
|
||||||
|
X-KDE-PluginInfo-Website=http://plasma.kde.org
|
||||||
|
X-KDE-PluginInfo-Category=
|
||||||
|
X-KDE-PluginInfo-Depends=
|
||||||
|
X-KDE-PluginInfo-License=LGPL
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=true
|
||||||
|
X-Plasma-API=5.0
|
||||||
|
|
||||||
|
[ContrastEffect]
|
||||||
|
enabled=true
|
||||||
|
contrast=0.2
|
||||||
|
intensity=2.0
|
||||||
|
saturation=1.7
|
@ -36,6 +36,7 @@ void ThemeTest::initTestCase()
|
|||||||
// set default icon theme to test-theme
|
// set default icon theme to test-theme
|
||||||
QStandardPaths::setTestModeEnabled(true);
|
QStandardPaths::setTestModeEnabled(true);
|
||||||
|
|
||||||
|
m_theme = new Plasma::Theme("testtheme", this);
|
||||||
QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
|
QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
|
||||||
|
|
||||||
if(!QDir(configPath).mkpath(QStringLiteral("."))) {
|
if(!QDir(configPath).mkpath(QStringLiteral("."))) {
|
||||||
@ -95,5 +96,77 @@ void ThemeTest::loadSvgIcon()
|
|||||||
QVERIFY(!m_svg->theme()->findInCache(cacheId, result));
|
QVERIFY(!m_svg->theme()->findInCache(cacheId, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeTest::testColors()
|
||||||
|
{
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||||
|
Plasma::Theme::NormalColorGroup), QColor(49,54,59));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||||
|
Plasma::Theme::NormalColorGroup), QColor(239,240,241));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||||
|
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||||
|
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||||
|
Plasma::Theme::NormalColorGroup), QColor(30,146,255));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||||
|
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||||
|
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||||
|
Plasma::Theme::NormalColorGroup).name(), QColor(163,214,251).name());
|
||||||
|
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup), QColor(49,54,59));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup), QColor(239,240,241));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup), QColor(30,146,255));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||||
|
Plasma::Theme::ButtonColorGroup).name(), QColor(163,214,251).name());
|
||||||
|
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||||
|
Plasma::Theme::ViewColorGroup), QColor(49,54,59));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||||
|
Plasma::Theme::ViewColorGroup), QColor(252,252,252));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||||
|
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||||
|
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||||
|
Plasma::Theme::ViewColorGroup), QColor(30,146,255));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||||
|
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||||
|
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||||
|
Plasma::Theme::ViewColorGroup).name(), QColor(163,214,251).name());
|
||||||
|
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup), QColor(239,240,241));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup), QColor(49,54,59));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup), QColor(40,146,255));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
|
||||||
|
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||||
|
Plasma::Theme::ComplementaryColorGroup).name(), QColor(169,214,249).name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QTEST_MAIN(ThemeTest)
|
QTEST_MAIN(ThemeTest)
|
||||||
|
|
||||||
|
@ -34,9 +34,11 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void loadSvgIcon();
|
void loadSvgIcon();
|
||||||
|
void testColors();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Plasma::Svg *m_svg;
|
Plasma::Svg *m_svg;
|
||||||
|
Plasma::Theme *m_theme;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -154,6 +154,17 @@ QColor ColorScope::highlightColor() const
|
|||||||
return m_theme.color(Plasma::Theme::HighlightColor, m_group);
|
return m_theme.color(Plasma::Theme::HighlightColor, m_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor ColorScope::highlightedTextColor() const
|
||||||
|
{
|
||||||
|
if (m_inherit) {
|
||||||
|
ColorScope *s = findParentScope();
|
||||||
|
if (s) {
|
||||||
|
return s->highlightedTextColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_theme.color(Plasma::Theme::HighlightedTextColor, m_group);
|
||||||
|
}
|
||||||
|
|
||||||
QColor ColorScope::backgroundColor() const
|
QColor ColorScope::backgroundColor() const
|
||||||
{
|
{
|
||||||
if (m_inherit) {
|
if (m_inherit) {
|
||||||
|
@ -54,6 +54,11 @@ class ColorScope : public QQuickItem
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY colorsChanged)
|
Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY colorsChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The highlighted text color within this colorscope
|
||||||
|
*/
|
||||||
|
Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor NOTIFY colorsChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The background color that should be used within this colorscope
|
* The background color that should be used within this colorscope
|
||||||
*/
|
*/
|
||||||
@ -69,8 +74,9 @@ public:
|
|||||||
|
|
||||||
QColor textColor() const;
|
QColor textColor() const;
|
||||||
QColor highlightColor() const;
|
QColor highlightColor() const;
|
||||||
|
QColor highlightedTextColor() const;
|
||||||
QColor backgroundColor() const;
|
QColor backgroundColor() 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);
|
||||||
|
|
||||||
|
@ -44,6 +44,11 @@ QColor QuickTheme::highlightColor() const
|
|||||||
return Plasma::Theme::color(Plasma::Theme::HighlightColor);
|
return Plasma::Theme::color(Plasma::Theme::HighlightColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor QuickTheme::highlightedTextColor() const
|
||||||
|
{
|
||||||
|
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor);
|
||||||
|
}
|
||||||
|
|
||||||
QColor QuickTheme::backgroundColor() const
|
QColor QuickTheme::backgroundColor() const
|
||||||
{
|
{
|
||||||
return Plasma::Theme::color(Plasma::Theme::BackgroundColor);
|
return Plasma::Theme::color(Plasma::Theme::BackgroundColor);
|
||||||
@ -79,6 +84,11 @@ QColor QuickTheme::buttonFocusColor() const
|
|||||||
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ButtonColorGroup);
|
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ButtonColorGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor QuickTheme::buttonHighlightedTextColor() const
|
||||||
|
{
|
||||||
|
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ButtonColorGroup);
|
||||||
|
}
|
||||||
|
|
||||||
QColor QuickTheme::viewTextColor() const
|
QColor QuickTheme::viewTextColor() const
|
||||||
{
|
{
|
||||||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup);
|
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup);
|
||||||
@ -99,6 +109,11 @@ QColor QuickTheme::viewFocusColor() const
|
|||||||
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ViewColorGroup);
|
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ViewColorGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor QuickTheme::viewHighlightedTextColor() const
|
||||||
|
{
|
||||||
|
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, 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);
|
||||||
@ -119,6 +134,11 @@ QColor QuickTheme::complementaryFocusColor() const
|
|||||||
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ComplementaryColorGroup);
|
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ComplementaryColorGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor QuickTheme::complementaryHighlightedTextColor() const
|
||||||
|
{
|
||||||
|
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ComplementaryColorGroup);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_quicktheme.cpp"
|
#include "moc_quicktheme.cpp"
|
||||||
|
@ -49,22 +49,28 @@ class QuickTheme : public Plasma::Theme
|
|||||||
// colors
|
// colors
|
||||||
Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChangedProxy)
|
Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChangedProxy)
|
||||||
Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChangedProxy)
|
Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChangedProxy)
|
||||||
|
Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor NOTIFY themeChangedProxy)
|
||||||
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChangedProxy)
|
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChangedProxy)
|
||||||
Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY themeChangedProxy)
|
|
||||||
Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor 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 buttonTextColor READ buttonTextColor 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 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 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)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QuickTheme(QObject *parent = 0);
|
explicit QuickTheme(QObject *parent = 0);
|
||||||
@ -84,6 +90,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
QColor highlightColor() const;
|
QColor highlightColor() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The theme's colorscheme's highlighted text color
|
||||||
|
* @since 5.22
|
||||||
|
*/
|
||||||
|
QColor highlightedTextColor() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The theme's colorscheme's background color
|
* @return The theme's colorscheme's background color
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
@ -126,6 +138,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
QColor buttonFocusColor() const;
|
QColor buttonFocusColor() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The theme's colorscheme's highlighted text color for buttons
|
||||||
|
* @since 5.22
|
||||||
|
*/
|
||||||
|
QColor buttonHighlightedTextColor() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The theme's colorscheme's text color in views
|
* @return The theme's colorscheme's text color in views
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
@ -150,6 +168,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
QColor viewFocusColor() const;
|
QColor viewFocusColor() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The theme's colorscheme's highlighted text color for views
|
||||||
|
* @since 5.22
|
||||||
|
*/
|
||||||
|
QColor viewHighlightedTextColor() 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
|
||||||
@ -174,6 +198,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
QColor complementaryFocusColor() const;
|
QColor complementaryFocusColor() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The theme's colorscheme's highlighted text color for "complementary" areas
|
||||||
|
* @since 5.22
|
||||||
|
*/
|
||||||
|
QColor complementaryHighlightedTextColor() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void themeChangedProxy();
|
void themeChangedProxy();
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ QtQuickControlStyle.TextAreaStyle {
|
|||||||
backgroundColor: "transparent"
|
backgroundColor: "transparent"
|
||||||
textColor: control.backgroundVisible ? theme.viewTextColor : PlasmaCore.ColorScope.textColor
|
textColor: control.backgroundVisible ? theme.viewTextColor : PlasmaCore.ColorScope.textColor
|
||||||
selectionColor: control.backgroundVisible ? theme.viewFocusColor : PlasmaCore.ColorScope.highlightColor
|
selectionColor: control.backgroundVisible ? theme.viewFocusColor : PlasmaCore.ColorScope.highlightColor
|
||||||
selectedTextColor: control.backgroundVisible ? theme.viewBackgroundColor : PlasmaCore.ColorScope.backgroundColor
|
selectedTextColor: control.backgroundVisible ? theme.viewHighlightedTextColor : PlasmaCore.ColorScope.highlightedTextColor
|
||||||
|
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ QtQuickControlStyle.TextFieldStyle {
|
|||||||
|
|
||||||
textColor: control.enabled ? theme.viewTextColor : Qt.rgba(theme.viewTextColor.r, theme.viewTextColor.g, theme.viewTextColor.b, 0.6)
|
textColor: control.enabled ? theme.viewTextColor : Qt.rgba(theme.viewTextColor.r, theme.viewTextColor.g, theme.viewTextColor.b, 0.6)
|
||||||
selectionColor: theme.viewFocusColor
|
selectionColor: theme.viewFocusColor
|
||||||
selectedTextColor: theme.viewBackgroundColor
|
selectedTextColor: theme.viewHighlightedTextColor
|
||||||
placeholderTextColor: Qt.rgba(theme.viewTextColor.r, theme.viewTextColor.g, theme.viewTextColor.b, 0.5)
|
placeholderTextColor: Qt.rgba(theme.viewTextColor.r, theme.viewTextColor.g, theme.viewTextColor.b, 0.5)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -439,6 +439,7 @@ const QString ThemePrivate::processStyleSheet(const QString &css)
|
|||||||
elements[QStringLiteral("%textcolor")] = color(Theme::TextColor, Theme::NormalColorGroup).name();
|
elements[QStringLiteral("%textcolor")] = color(Theme::TextColor, Theme::NormalColorGroup).name();
|
||||||
elements[QStringLiteral("%backgroundcolor")] = color(Theme::BackgroundColor, Theme::NormalColorGroup).name();
|
elements[QStringLiteral("%backgroundcolor")] = color(Theme::BackgroundColor, Theme::NormalColorGroup).name();
|
||||||
elements[QStringLiteral("%highlightcolor")] = color(Theme::HighlightColor, Theme::NormalColorGroup).name();
|
elements[QStringLiteral("%highlightcolor")] = color(Theme::HighlightColor, Theme::NormalColorGroup).name();
|
||||||
|
elements[QStringLiteral("%highlightedtextcolor")] = color(Theme::HighlightedTextColor, Theme::NormalColorGroup).name();
|
||||||
elements[QStringLiteral("%visitedlink")] = color(Theme::VisitedLinkColor, Theme::NormalColorGroup).name();
|
elements[QStringLiteral("%visitedlink")] = color(Theme::VisitedLinkColor, Theme::NormalColorGroup).name();
|
||||||
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();
|
||||||
@ -448,16 +449,19 @@ const QString ThemePrivate::processStyleSheet(const QString &css)
|
|||||||
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("%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("%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();
|
||||||
|
|
||||||
QFont font = QGuiApplication::font();
|
QFont font = QGuiApplication::font();
|
||||||
elements[QStringLiteral("%fontsize")] = QStringLiteral("%1pt").arg(font.pointSize());
|
elements[QStringLiteral("%fontsize")] = QStringLiteral("%1pt").arg(font.pointSize());
|
||||||
@ -484,41 +488,47 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group)
|
|||||||
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%buttonbackgroundcolor"));
|
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%buttonbackgroundcolor"));
|
||||||
|
|
||||||
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%buttonhovercolor"));
|
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%buttonhovercolor"));
|
||||||
|
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%buttonhighlightedtextcolor"));
|
||||||
break;
|
break;
|
||||||
case Theme::ViewColorGroup:
|
case Theme::ViewColorGroup:
|
||||||
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%viewtextcolor"));
|
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%viewtextcolor"));
|
||||||
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%viewbackgroundcolor"));
|
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%viewbackgroundcolor"));
|
||||||
|
|
||||||
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%viewhovercolor"));
|
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%viewhovercolor"));
|
||||||
|
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%viewhighlightedtextcolor"));
|
||||||
break;
|
break;
|
||||||
case Theme::ComplementaryColorGroup:
|
case Theme::ComplementaryColorGroup:
|
||||||
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%complementarytextcolor"));
|
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%complementarytextcolor"));
|
||||||
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%complementarybackgroundcolor"));
|
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%complementarybackgroundcolor"));
|
||||||
|
|
||||||
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%complementaryhovercolor"));
|
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%complementaryhovercolor"));
|
||||||
|
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%complementaryhighlightedtextcolor"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%textcolor"));
|
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%textcolor"));
|
||||||
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%backgroundcolor"));
|
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%backgroundcolor"));
|
||||||
|
|
||||||
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("ButtonText"), QStringLiteral("%buttontextcolor"));
|
stylesheet += skel.arg(QStringLiteral("ButtonText"), QStringLiteral("%buttontextcolor"));
|
||||||
stylesheet += skel.arg(QStringLiteral("ButtonBackground"), QStringLiteral("%buttonbackgroundcolor"));
|
stylesheet += skel.arg(QStringLiteral("ButtonBackground"), QStringLiteral("%buttonbackgroundcolor"));
|
||||||
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("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("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 = processStyleSheet(stylesheet);
|
stylesheet = processStyleSheet(stylesheet);
|
||||||
cachedSvgStyleSheets.insert(group, stylesheet);
|
cachedSvgStyleSheets.insert(group, stylesheet);
|
||||||
@ -623,6 +633,9 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
|
|||||||
|
|
||||||
case Theme::VisitedLinkColor:
|
case Theme::VisitedLinkColor:
|
||||||
return scheme->foreground(KColorScheme::VisitedText).color();
|
return scheme->foreground(KColorScheme::VisitedText).color();
|
||||||
|
|
||||||
|
case Theme::HighlightedTextColor:
|
||||||
|
return scheme->shade(scheme->decoration(KColorScheme::HoverColor).color(), KColorScheme::LightShade, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QColor();
|
return QColor();
|
||||||
|
@ -75,6 +75,7 @@ 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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ColorGroup {
|
enum ColorGroup {
|
||||||
|
Loading…
Reference in New Issue
Block a user