Commit e91ccdf0 authored by Marco Martin's avatar Marco Martin

Introduce the Header color set

Summary:
This introduces two concepts: a new color set for Header (or: titlebar?
open question)
and the possibility for a color set to have a different config group (a
sub group) for different states (there, for inactive)

the Header area should probably also going to slowly relace the WM
section of color themes

This is needed for implement properly T10201, this graphical union
between the titlebar and the toolbar.

There is a problem of NColorSets that has been recently added,
because it makes impossible to hard/impossible to
properly add a set in a 100% abi compatible way, strictly speaking it
should be compatible tough keeping NColorSets as the last value, is a
kindof behavior change, though *should* be acceptable (old users would
get the Header value as NColorSets but everything working never the less)

Test Plan: doing a color set with Header group, the proper values get read

Reviewers: #vdg, #plasma, cblack, ndavis

Reviewed By: #vdg, #plasma, cblack, ndavis

Subscribers: davidre, ndavis, cblack, kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T10201

Differential Revision: https://phabricator.kde.org/D29232
parent 76503074
......@@ -254,6 +254,19 @@ static const SetDefaultColors defaultComplementaryColors = {
{ 46, 174, 230 } // Positive
};
static const SetDefaultColors defaultHeaderColors = {
{ 227, 229, 231 }, // Background
{ 239, 240, 241 }, // Alternate
{ 35, 38, 41 }, // Normal
{ 112, 125, 138 }, // Inactive
{ 61, 174, 233 }, // Active
{ 41, 128, 185 }, // Link
{ 155, 89, 182 }, // Visited
{ 218, 68, 83 }, // Negative
{ 246, 116, 0 }, // Neutral
{ 39, 174, 96 } // Positive
};
static const DecoDefaultColors defaultDecorationColors = {
{ 61, 174, 233 }, // Focus
{ 147, 206, 233 }, // Hover
......@@ -344,6 +357,14 @@ void KColorSchemePrivate::init(const KSharedConfigPtr &config,
const SetDefaultColors &defaults)
{
KConfigGroup cfg(config, group);
bool hasInactivePalette = false;
if (state == QPalette::Inactive) {
KConfigGroup inactiveGroup = KConfigGroup(&cfg, "Inactive");
if (inactiveGroup.exists()) {
cfg = inactiveGroup;
hasInactivePalette = true;
}
}
// loaded-from-config colors
_brushes.fg[KColorScheme::NormalText] = cfg.readEntry("ForegroundNormal", SET_DEFAULT(NormalText));
......@@ -359,7 +380,7 @@ void KColorSchemePrivate::init(const KSharedConfigPtr &config,
_brushes.deco[KColorScheme::HoverColor] = cfg.readEntry("DecorationHover", DECO_DEFAULT(Hover));
// apply state adjustments
if (state != QPalette::Active) {
if (state != QPalette::Active || (state == QPalette::Inactive && !hasInactivePalette)) {
StateEffects effects(state, config);
for (auto &fg : _brushes.fg) {
fg = effects.brush(fg, _brushes.bg[KColorScheme::NormalBackground]);
......@@ -474,6 +495,9 @@ KColorScheme::KColorScheme(QPalette::ColorGroup state, ColorSet set, KSharedConf
case Complementary:
d = new KColorSchemePrivate(config, state, "Colors:Complementary", defaultComplementaryColors);
break;
case Header:
d = new KColorSchemePrivate(config, state, "Colors:Header", defaultHeaderColors);
break;
default:
d = new KColorSchemePrivate(config, state, "Colors:View", defaultViewColors);
}
......
......@@ -123,8 +123,14 @@ public:
* @since 5.19
*/
Complementary,
/**
* Colors for header areas that thould be used both by the top toolbar and the titlebar titlebar.
* @since 5.69
*/
Header,
/**
* Number of color sets.
* Note: don't use this
* @since 5.65
*/
NColorSets
......
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