Commit 1a1b5549 authored by Noah Davis's avatar Noah Davis 🌵
Browse files

[Colors KCM] Support Header ColorSet

parent 008fedae
......@@ -365,7 +365,9 @@ void KCMColors::saveColors()
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QStringLiteral("color-schemes/%1.colors").arg(m_model->selectedScheme()));
KSharedConfigPtr config = KSharedConfig::openConfig(path);
// Using KConfig::SimpleConfig because otherwise Header colors won't be
// rewritten when a new color scheme is loaded.
KSharedConfigPtr config = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
const QStringList colorSetGroupList{
QStringLiteral("Colors:View"),
......@@ -373,7 +375,8 @@ void KCMColors::saveColors()
QStringLiteral("Colors:Button"),
QStringLiteral("Colors:Selection"),
QStringLiteral("Colors:Tooltip"),
QStringLiteral("Colors:Complementary")
QStringLiteral("Colors:Complementary"),
QStringLiteral("Colors:Header")
};
const QList<KColorScheme> colorSchemes{
......@@ -382,7 +385,8 @@ void KCMColors::saveColors()
KColorScheme(QPalette::Active, KColorScheme::Button, config),
KColorScheme(QPalette::Active, KColorScheme::Selection, config),
KColorScheme(QPalette::Active, KColorScheme::Tooltip, config),
KColorScheme(QPalette::Active, KColorScheme::Complementary, config)
KColorScheme(QPalette::Active, KColorScheme::Complementary, config),
KColorScheme(QPalette::Active, KColorScheme::Header, config)
};
for (int i = 0; i < colorSchemes.length(); ++i) {
......@@ -403,6 +407,7 @@ void KCMColors::saveColors()
KConfigGroup groupWMTheme(config, "WM");
KConfigGroup groupWMOut(m_config, "WM");
KColorScheme inactiveHeaderColorScheme(QPalette::Inactive, KColorScheme::Header, config);
const QStringList colorItemListWM{
QStringLiteral("activeBackground"),
......@@ -414,12 +419,12 @@ void KCMColors::saveColors()
};
const QVector<QColor> defaultWMColors{
QColor(71,80,87),
QColor(239,240,241),
QColor(239,240,241),
QColor(189,195,199),
QColor(255,255,255),
QColor(75,71,67)
colorSchemes[KColorScheme::Header].background().color(),
colorSchemes[KColorScheme::Header].foreground().color(),
inactiveHeaderColorScheme.background().color(),
inactiveHeaderColorScheme.foreground().color(),
colorSchemes[KColorScheme::Header].background().color(),
inactiveHeaderColorScheme.background().color()
};
int i = 0;
......
......@@ -185,10 +185,10 @@ void ColorsModel::load()
const QPalette palette = KColorScheme::createApplicationPalette(config);
// from kwin/decorations/decorationpalette.cpp
KColorScheme headerColorScheme(QPalette::Active, KColorScheme::Header, config);
KConfigGroup wmConfig(config, QStringLiteral("WM"));
const QColor activeTitleBarBackground = wmConfig.readEntry("activeBackground", palette.color(QPalette::Active, QPalette::Highlight));
const QColor activeTitleBarForeground = wmConfig.readEntry("activeForeground", palette.color(QPalette::Active, QPalette::HighlightedText));
const QColor activeTitleBarBackground = wmConfig.readEntry("activeBackground", headerColorScheme.background().color());
const QColor activeTitleBarForeground = wmConfig.readEntry("activeForeground", headerColorScheme.foreground().color());
ColorsModelData item{
name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment