Krita Source Code Documentation
Loading...
Searching...
No Matches
kcolorscheme.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#include "kcolorscheme.h"
7
8#include <kconfig.h>
9#include <kconfiggroup.h>
10#include <ksharedconfig.h>
11#include <kcolorutils.h>
12
13#include <QColor>
14#include <QBrush>
15#include <QWidget>
16
17//BEGIN StateEffects
19{
20public:
21 explicit StateEffects(QPalette::ColorGroup state, const KSharedConfigPtr &);
22 ~StateEffects() {} //{ delete chain; } not needed yet
23
24 QBrush brush(const QBrush &background) const;
25 QBrush brush(const QBrush &foreground, const QBrush &background) const;
26
27private:
28 enum Effects {
29 // Effects
31 Color = 1,
33 // Intensity
38 // Color
43 // Contrast
46 ContrastTint = 2
47 };
48
49 int _effects[3];
50 double _amount[3];
51 QColor _color;
52// StateEffects *_chain; not needed yet
53};
54
55StateEffects::StateEffects(QPalette::ColorGroup state, const KSharedConfigPtr &config)
56 : _color(0, 0, 0, 0) //, _chain(0) not needed yet
57{
58 QString group;
59 if (state == QPalette::Disabled) {
60 group = QLatin1String("ColorEffects:Disabled");
61 } else if (state == QPalette::Inactive) {
62 group = QLatin1String("ColorEffects:Inactive");
63 }
64
65 _effects[0] = 0;
66 _effects[1] = 0;
67 _effects[2] = 0;
68
69 // NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
70 if (! group.isEmpty()) {
71 KConfigGroup cfg(config, group);
72 const bool enabledByDefault = (state == QPalette::Disabled);
73 if (cfg.readEntry("Enable", enabledByDefault)) {
74 _effects[Intensity] = cfg.readEntry("IntensityEffect",
75 (int)(state == QPalette::Disabled ? IntensityDarken : IntensityNoEffect));
76 _effects[Color] = cfg.readEntry("ColorEffect",
77 (int)(state == QPalette::Disabled ? ColorNoEffect : ColorDesaturate));
78 _effects[Contrast] = cfg.readEntry("ContrastEffect",
79 (int)(state == QPalette::Disabled ? ContrastFade : ContrastTint));
80 _amount[Intensity] = cfg.readEntry("IntensityAmount", state == QPalette::Disabled ? 0.10 : 0.0);
81 _amount[Color] = cfg.readEntry("ColorAmount", state == QPalette::Disabled ? 0.0 : -0.9);
82 _amount[Contrast] = cfg.readEntry("ContrastAmount", state == QPalette::Disabled ? 0.65 : 0.25);
84 _color = cfg.readEntry("Color", state == QPalette::Disabled ? QColor(56, 56, 56) : QColor(112, 111, 110));
85 }
86 }
87 }
88}
89
90QBrush StateEffects::brush(const QBrush &background) const
91{
92 QColor color = background.color(); // TODO - actually work on brushes
93 switch (_effects[Intensity]) {
94 case IntensityShade:
95 color = KColorUtils::shade(color, _amount[Intensity]);
96 break;
97 case IntensityDarken:
98 color = KColorUtils::darken(color, _amount[Intensity]);
99 break;
100 case IntensityLighten:
101 color = KColorUtils::lighten(color, _amount[Intensity]);
102 break;
103 }
104 switch (_effects[Color]) {
105 case ColorDesaturate:
106 color = KColorUtils::darken(color, 0.0, 1.0 - _amount[Color]);
107 break;
108 case ColorFade:
109 color = KColorUtils::mix(color, _color, _amount[Color]);
110 break;
111 case ColorTint:
112 color = KColorUtils::tint(color, _color, _amount[Color]);
113 break;
114 }
115 return QBrush(color);
116}
117
118QBrush StateEffects::brush(const QBrush &foreground, const QBrush &background) const
119{
120 QColor color = foreground.color(); // TODO - actually work on brushes
121 QColor bg = background.color();
122 // Apply the foreground effects
123 switch (_effects[Contrast]) {
124 case ContrastFade:
125 color = KColorUtils::mix(color, bg, _amount[Contrast]);
126 break;
127 case ContrastTint:
128 color = KColorUtils::tint(color, bg, _amount[Contrast]);
129 break;
130 }
131 // Now apply global effects
132 return brush(color);
133}
134//END StateEffects
135
136//BEGIN default colors
149
151 int Hover[3];
152 int Focus[3];
153};
154
156 { 255, 255, 255 }, // Background
157 { 248, 247, 246 }, // Alternate
158 { 31, 28, 27 }, // Normal
159 { 137, 136, 135 }, // Inactive
160 { 146, 76, 157 }, // Active
161 { 0, 87, 174 }, // Link
162 { 100, 74, 155 }, // Visited
163 { 191, 3, 3 }, // Negative
164 { 176, 128, 0 }, // Neutral
165 { 0, 110, 40 } // Positive
166};
167
169 { 214, 210, 208 }, // Background
170 { 218, 217, 216 }, // Alternate
171 { 34, 31, 30 }, // Normal
172 { 137, 136, 135 }, // Inactive
173 { 146, 76, 157 }, // Active
174 { 0, 87, 174 }, // Link
175 { 100, 74, 155 }, // Visited
176 { 191, 3, 3 }, // Negative
177 { 176, 128, 0 }, // Neutral
178 { 0, 110, 40 } // Positive
179};
180
182 { 223, 220, 217 }, // Background
183 { 224, 223, 222 }, // Alternate
184 { 34, 31, 30 }, // Normal
185 { 137, 136, 135 }, // Inactive
186 { 146, 76, 157 }, // Active
187 { 0, 87, 174 }, // Link
188 { 100, 74, 155 }, // Visited
189 { 191, 3, 3 }, // Negative
190 { 176, 128, 0 }, // Neutral
191 { 0, 110, 40 } // Positive
192};
193
195 { 67, 172, 232 }, // Background
196 { 62, 138, 204 }, // Alternate
197 { 255, 255, 255 }, // Normal
198 { 199, 226, 248 }, // Inactive
199 { 108, 36, 119 }, // Active
200 { 0, 49, 110 }, // Link
201 { 69, 40, 134 }, // Visited
202 { 156, 14, 14 }, // Negative
203 { 255, 221, 0 }, // Neutral
204 { 128, 255, 128 } // Positive
205};
206
208 { 24, 21, 19 }, // Background
209 { 196, 224, 255 }, // Alternate
210 { 231, 253, 255 }, // Normal
211 { 137, 136, 135 }, // Inactive
212 { 255, 128, 224 }, // Active
213 { 88, 172, 255 }, // Link
214 { 150, 111, 232 }, // Visited
215 { 191, 3, 3 }, // Negative
216 { 176, 128, 0 }, // Neutral
217 { 0, 110, 40 } // Positive
218};
219
221 { 110, 214, 255 }, // Hover
222 { 58, 167, 221 }, // Focus
223};
224//END default colors
225
226//BEGIN KColorSchemePrivate
227class KColorSchemePrivate : public QSharedData
228{
229public:
230 explicit KColorSchemePrivate(const KSharedConfigPtr &, QPalette::ColorGroup, const char *, SetDefaultColors);
231 explicit KColorSchemePrivate(const KSharedConfigPtr &, QPalette::ColorGroup, const char *, SetDefaultColors, const QBrush &);
233
237 qreal contrast() const;
238private:
239 struct {
240 QBrush fg[8], bg[8], deco[2];
243
244 void init(const KSharedConfigPtr &, QPalette::ColorGroup, const char *, SetDefaultColors);
245};
246
247#define DEFAULT(c) QColor( c[0], c[1], c[2] )
248#define SET_DEFAULT(a) DEFAULT( defaults.a )
249#define DECO_DEFAULT(a) DEFAULT( defaultDecorationColors.a )
250
251KColorSchemePrivate::KColorSchemePrivate(const KSharedConfigPtr &config,
252 QPalette::ColorGroup state,
253 const char *group,
254 SetDefaultColors defaults)
255{
256 KConfigGroup cfg(config, group);
258
259 // loaded-from-config colors (no adjustment)
260 _brushes.bg[0] = cfg.readEntry("BackgroundNormal", SET_DEFAULT(NormalBackground));
261 _brushes.bg[1] = cfg.readEntry("BackgroundAlternate", SET_DEFAULT(AlternateBackground));
262
263 // the rest
264 init(config, state, group, defaults);
265}
266
267KColorSchemePrivate::KColorSchemePrivate(const KSharedConfigPtr &config,
268 QPalette::ColorGroup state,
269 const char *group,
270 SetDefaultColors defaults,
271 const QBrush &tint)
272{
273 KConfigGroup cfg(config, group);
275
276 // loaded-from-config colors
277 _brushes.bg[0] = cfg.readEntry("BackgroundNormal", SET_DEFAULT(NormalBackground));
278 _brushes.bg[1] = cfg.readEntry("BackgroundAlternate", SET_DEFAULT(AlternateBackground));
279
280 // adjustment
281 _brushes.bg[0] = KColorUtils::tint(_brushes.bg[0].color(), tint.color(), 0.4);
282 _brushes.bg[1] = KColorUtils::tint(_brushes.bg[1].color(), tint.color(), 0.4);
283
284 // the rest
285 init(config, state, group, defaults);
286}
287
288void KColorSchemePrivate::init(const KSharedConfigPtr &config,
289 QPalette::ColorGroup state,
290 const char *group,
291 SetDefaultColors defaults)
292{
293 KConfigGroup cfg(config, group);
294
295 // loaded-from-config colors
296 _brushes.fg[0] = cfg.readEntry("ForegroundNormal", SET_DEFAULT(NormalText));
297 _brushes.fg[1] = cfg.readEntry("ForegroundInactive", SET_DEFAULT(InactiveText));
298 _brushes.fg[2] = cfg.readEntry("ForegroundActive", SET_DEFAULT(ActiveText));
299 _brushes.fg[3] = cfg.readEntry("ForegroundLink", SET_DEFAULT(LinkText));
300 _brushes.fg[4] = cfg.readEntry("ForegroundVisited", SET_DEFAULT(VisitedText));
301 _brushes.fg[5] = cfg.readEntry("ForegroundNegative", SET_DEFAULT(NegativeText));
302 _brushes.fg[6] = cfg.readEntry("ForegroundNeutral", SET_DEFAULT(NeutralText));
303 _brushes.fg[7] = cfg.readEntry("ForegroundPositive", SET_DEFAULT(PositiveText));
304
305 _brushes.deco[0] = cfg.readEntry("DecorationHover", DECO_DEFAULT(Hover));
306 _brushes.deco[1] = cfg.readEntry("DecorationFocus", DECO_DEFAULT(Focus));
307
308 // apply state adjustments
309 if (state != QPalette::Active) {
310 StateEffects effects(state, config);
311 for (int i = 0; i < 8; i++) {
312 _brushes.fg[i] = effects.brush(_brushes.fg[i], _brushes.bg[0]);
313 }
314 _brushes.deco[0] = effects.brush(_brushes.deco[0], _brushes.bg[0]);
315 _brushes.deco[1] = effects.brush(_brushes.deco[1], _brushes.bg[0]);
316 _brushes.bg[0] = effects.brush(_brushes.bg[0]);
317 _brushes.bg[1] = effects.brush(_brushes.bg[1]);
318 }
319
320 // calculated backgrounds
321 _brushes.bg[2] = KColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[2].color());
322 _brushes.bg[3] = KColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[3].color());
323 _brushes.bg[4] = KColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[4].color());
324 _brushes.bg[5] = KColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[5].color());
325 _brushes.bg[6] = KColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[6].color());
326 _brushes.bg[7] = KColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[7].color());
327}
328
330{
331 switch (role) {
333 return _brushes.bg[1];
335 return _brushes.bg[2];
337 return _brushes.bg[3];
339 return _brushes.bg[4];
341 return _brushes.bg[5];
343 return _brushes.bg[6];
345 return _brushes.bg[7];
346 default:
347 return _brushes.bg[0];
348 }
349}
350
352{
353 switch (role) {
355 return _brushes.fg[1];
357 return _brushes.fg[2];
359 return _brushes.fg[3];
361 return _brushes.fg[4];
363 return _brushes.fg[5];
365 return _brushes.fg[6];
367 return _brushes.fg[7];
368 default:
369 return _brushes.fg[0];
370 }
371}
372
374{
375 switch (role) {
377 return _brushes.deco[1];
378 default:
379 return _brushes.deco[0];
380 }
381}
382
384{
385 return _contrast;
386}
387//END KColorSchemePrivate
388
389//BEGIN KColorScheme
390KColorScheme::KColorScheme(const KColorScheme &other) : d(other.d)
391{
392}
393
395{
396 d = other.d;
397 return *this;
398}
399
403
404KColorScheme::KColorScheme(QPalette::ColorGroup state, ColorSet set, KSharedConfigPtr config)
405{
406 if (!config) {
407 config = KSharedConfig::openConfig();
408 }
409
410 switch (set) {
411 case Window:
412 d = new KColorSchemePrivate(config, state, "Colors:Window", defaultWindowColors);
413 break;
414 case Button:
415 d = new KColorSchemePrivate(config, state, "Colors:Button", defaultButtonColors);
416 break;
417 case Selection: {
418 KConfigGroup group(config, "ColorEffects:Inactive");
419 // NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
420 bool inactiveSelectionEffect = group.readEntry("ChangeSelectionColor", group.readEntry("Enable", true));
421 // if enabled, inactiver/disabled uses Window colors instead, ala gtk
422 // ...except tinted with the Selection:NormalBackground color so it looks more like selection
423 if (state == QPalette::Active || (state == QPalette::Inactive && !inactiveSelectionEffect)) {
424 d = new KColorSchemePrivate(config, state, "Colors:Selection", defaultSelectionColors);
425 } else if (state == QPalette::Inactive)
426 d = new KColorSchemePrivate(config, state, "Colors:Window", defaultWindowColors,
427 KColorScheme(QPalette::Active, Selection, config).background());
428 else { // disabled (...and still want this branch when inactive+disabled exists)
429 d = new KColorSchemePrivate(config, state, "Colors:Window", defaultWindowColors);
430 }
431 } break;
432 case Tooltip:
433 d = new KColorSchemePrivate(config, state, "Colors:Tooltip", defaultTooltipColors);
434 break;
435 default:
436 d = new KColorSchemePrivate(config, state, "Colors:View", defaultViewColors);
437 }
438}
439
440// static
442{
443 KConfigGroup g(KSharedConfig::openConfig(), "KDE");
444 return g.readEntry("contrast", 7);
445}
446
447// static
448qreal KColorScheme::contrastF(const KSharedConfigPtr &config)
449{
450 if (config) {
451 KConfigGroup g(config, "KDE");
452 return 0.1 * g.readEntry("contrast", 7);
453 }
454 return 0.1 * (qreal)contrast();
455}
456
458{
459 return d->background(role);
460}
461
463{
464 return d->foreground(role);
465}
466
468{
469 return d->decoration(role);
470}
471
473{
474 return shade(background().color(), role, d->contrast());
475}
476
477QColor KColorScheme::shade(const QColor &color, ShadeRole role)
478{
479 return shade(color, role, KColorScheme::contrastF());
480}
481
482QColor KColorScheme::shade(const QColor &color, ShadeRole role, qreal contrast, qreal chromaAdjust)
483{
484 // nan -> 1.0
485 contrast = (1.0 > contrast ? (-1.0 < contrast ? contrast : -1.0) : 1.0);
486 qreal y = KColorUtils::luma(color), yi = 1.0 - y;
487
488 // handle very dark colors (base, mid, dark, shadow == midlight, light)
489 if (y < 0.006) {
490 switch (role) {
492 return KColorUtils::shade(color, 0.05 + 0.95 * contrast, chromaAdjust);
494 return KColorUtils::shade(color, 0.01 + 0.20 * contrast, chromaAdjust);
496 return KColorUtils::shade(color, 0.02 + 0.40 * contrast, chromaAdjust);
497 default:
498 return KColorUtils::shade(color, 0.03 + 0.60 * contrast, chromaAdjust);
499 }
500 }
501
502 // handle very light colors (base, midlight, light == mid, dark, shadow)
503 if (y > 0.93) {
504 switch (role) {
506 return KColorUtils::shade(color, -0.02 - 0.20 * contrast, chromaAdjust);
508 return KColorUtils::shade(color, -0.06 - 0.60 * contrast, chromaAdjust);
510 return KColorUtils::shade(color, -0.10 - 0.90 * contrast, chromaAdjust);
511 default:
512 return KColorUtils::shade(color, -0.04 - 0.40 * contrast, chromaAdjust);
513 }
514 }
515
516 // handle everything else
517 qreal lightAmount = (0.05 + y * 0.55) * (0.25 + contrast * 0.75);
518 qreal darkAmount = (- y) * (0.55 + contrast * 0.35);
519 switch (role) {
521 return KColorUtils::shade(color, lightAmount, chromaAdjust);
523 return KColorUtils::shade(color, (0.15 + 0.35 * yi) * lightAmount, chromaAdjust);
525 return KColorUtils::shade(color, (0.35 + 0.15 * y) * darkAmount, chromaAdjust);
527 return KColorUtils::shade(color, darkAmount, chromaAdjust);
528 default:
529 return KColorUtils::darken(KColorUtils::shade(color, darkAmount, chromaAdjust), 0.5 + 0.3 * y);
530 }
531}
532
533void KColorScheme::adjustBackground(QPalette &palette, BackgroundRole newRole, QPalette::ColorRole color,
534 ColorSet set, KSharedConfigPtr config)
535{
536 palette.setBrush(QPalette::Active, color, KColorScheme(QPalette::Active, set, config).background(newRole));
537 palette.setBrush(QPalette::Inactive, color, KColorScheme(QPalette::Inactive, set, config).background(newRole));
538 palette.setBrush(QPalette::Disabled, color, KColorScheme(QPalette::Disabled, set, config).background(newRole));
539}
540
541void KColorScheme::adjustForeground(QPalette &palette, ForegroundRole newRole, QPalette::ColorRole color,
542 ColorSet set, KSharedConfigPtr config)
543{
544 palette.setBrush(QPalette::Active, color, KColorScheme(QPalette::Active, set, config).foreground(newRole));
545 palette.setBrush(QPalette::Inactive, color, KColorScheme(QPalette::Inactive, set, config).foreground(newRole));
546 palette.setBrush(QPalette::Disabled, color, KColorScheme(QPalette::Disabled, set, config).foreground(newRole));
547}
548
549QPalette KColorScheme::createApplicationPalette(const KSharedConfigPtr &config)
550{
551 QPalette palette;
552
553 static const QPalette::ColorGroup states[3] = { QPalette::Active, QPalette::Inactive, QPalette::Disabled };
554
555 // TT thinks tooltips shouldn't use active, so we use our active colors for all states
556 KColorScheme schemeTooltip(QPalette::Active, KColorScheme::Tooltip, config);
557
558 for (int i = 0; i < 3; i++) {
559 QPalette::ColorGroup state = states[i];
560 KColorScheme schemeView(state, KColorScheme::View, config);
561 KColorScheme schemeWindow(state, KColorScheme::Window, config);
562 KColorScheme schemeButton(state, KColorScheme::Button, config);
563 KColorScheme schemeSelection(state, KColorScheme::Selection, config);
564
565 palette.setBrush(state, QPalette::WindowText, schemeWindow.foreground());
566 palette.setBrush(state, QPalette::Window, schemeWindow.background());
567 palette.setBrush(state, QPalette::Base, schemeView.background());
568 palette.setBrush(state, QPalette::Text, schemeView.foreground());
569 palette.setBrush(state, QPalette::Button, schemeButton.background());
570 palette.setBrush(state, QPalette::ButtonText, schemeButton.foreground());
571 palette.setBrush(state, QPalette::Highlight, schemeSelection.background());
572 palette.setBrush(state, QPalette::HighlightedText, schemeSelection.foreground());
573 palette.setBrush(state, QPalette::ToolTipBase, schemeTooltip.background());
574 palette.setBrush(state, QPalette::ToolTipText, schemeTooltip.foreground());
575
576 palette.setColor(state, QPalette::Light, schemeWindow.shade(KColorScheme::LightShade));
577 palette.setColor(state, QPalette::Midlight, schemeWindow.shade(KColorScheme::MidlightShade));
578 palette.setColor(state, QPalette::Mid, schemeWindow.shade(KColorScheme::MidShade));
579 palette.setColor(state, QPalette::Dark, schemeWindow.shade(KColorScheme::DarkShade));
580 palette.setColor(state, QPalette::Shadow, schemeWindow.shade(KColorScheme::ShadowShade));
581
582 palette.setBrush(state, QPalette::AlternateBase, schemeView.background(KColorScheme::AlternateBackground));
583 palette.setBrush(state, QPalette::Link, schemeView.foreground(KColorScheme::LinkText));
584 palette.setBrush(state, QPalette::LinkVisited, schemeView.foreground(KColorScheme::VisitedText));
585 }
586
587 return palette;
588}
589
590//END KColorScheme
591
592//BEGIN KStatefulBrush
593class KStatefulBrushPrivate : public QBrush // for now, just be a QBrush
594{
595public:
596 KStatefulBrushPrivate() : QBrush() {}
597 KStatefulBrushPrivate(const QBrush &brush) : QBrush(brush) {} // not explicit
598};
599
604
606 KSharedConfigPtr config)
607{
608 d = new KStatefulBrushPrivate[3];
609 d[0] = KColorScheme(QPalette::Active, set, config).foreground(role);
610 d[1] = KColorScheme(QPalette::Disabled, set, config).foreground(role);
611 d[2] = KColorScheme(QPalette::Inactive, set, config).foreground(role);
612}
613
615 KSharedConfigPtr config)
616{
617 d = new KStatefulBrushPrivate[3];
618 d[0] = KColorScheme(QPalette::Active, set, config).background(role);
619 d[1] = KColorScheme(QPalette::Disabled, set, config).background(role);
620 d[2] = KColorScheme(QPalette::Inactive, set, config).background(role);
621}
622
624 KSharedConfigPtr config)
625{
626 d = new KStatefulBrushPrivate[3];
627 d[0] = KColorScheme(QPalette::Active, set, config).decoration(role);
628 d[1] = KColorScheme(QPalette::Disabled, set, config).decoration(role);
629 d[2] = KColorScheme(QPalette::Inactive, set, config).decoration(role);
630}
631
632KStatefulBrush::KStatefulBrush(const QBrush &brush, KSharedConfigPtr config)
633{
634 if (!config) {
635 config = KSharedConfig::openConfig();
636 }
637 d = new KStatefulBrushPrivate[3];
638 d[0] = brush;
639 d[1] = StateEffects(QPalette::Disabled, config).brush(brush);
640 d[2] = StateEffects(QPalette::Inactive, config).brush(brush);
641}
642
643KStatefulBrush::KStatefulBrush(const QBrush &brush, const QBrush &background,
644 KSharedConfigPtr config)
645{
646 if (!config) {
647 config = KSharedConfig::openConfig();
648 }
649 d = new KStatefulBrushPrivate[3];
650 d[0] = brush;
651 d[1] = StateEffects(QPalette::Disabled, config).brush(brush, background);
652 d[2] = StateEffects(QPalette::Inactive, config).brush(brush, background);
653}
654
656{
657 d = new KStatefulBrushPrivate[3];
658 d[0] = other.d[0];
659 d[1] = other.d[1];
660 d[2] = other.d[2];
661}
662
664{
665 delete[] d;
666}
667
669{
670 d[0] = other.d[0];
671 d[1] = other.d[1];
672 d[2] = other.d[2];
673 return *this;
674}
675
676QBrush KStatefulBrush::brush(QPalette::ColorGroup state) const
677{
678 switch (state) {
679 case QPalette::Inactive:
680 return d[2];
681 case QPalette::Disabled:
682 return d[1];
683 default:
684 return d[0];
685 }
686}
687
688QBrush KStatefulBrush::brush(const QPalette &pal) const
689{
690 return brush(pal.currentColorGroup());
691}
692
693QBrush KStatefulBrush::brush(const QWidget *widget) const
694{
695 if (widget) {
696 return brush(widget->palette());
697 } else {
698 return QBrush();
699 }
700}
701//END KStatefulBrush
702
KColorSchemePrivate(const KSharedConfigPtr &, QPalette::ColorGroup, const char *, SetDefaultColors)
QBrush foreground(KColorScheme::ForegroundRole) const
void init(const KSharedConfigPtr &, QPalette::ColorGroup, const char *, SetDefaultColors)
struct KColorSchemePrivate::@9 _brushes
QBrush decoration(KColorScheme::DecorationRole) const
QBrush background(KColorScheme::BackgroundRole) const
qreal contrast() const
static void adjustForeground(QPalette &, ForegroundRole newRole=NormalText, QPalette::ColorRole color=QPalette::Text, ColorSet set=View, KSharedConfigPtr=KSharedConfigPtr())
static int contrast()
static QPalette createApplicationPalette(const KSharedConfigPtr &config)
static qreal contrastF(const KSharedConfigPtr &config=KSharedConfigPtr())
KColorScheme(const KColorScheme &)
QBrush background(BackgroundRole=NormalBackground) const
KColorScheme & operator=(const KColorScheme &)
QExplicitlySharedDataPointer< KColorSchemePrivate > d
static void adjustBackground(QPalette &, BackgroundRole newRole=NormalBackground, QPalette::ColorRole color=QPalette::Base, ColorSet set=View, KSharedConfigPtr=KSharedConfigPtr())
QBrush decoration(DecorationRole) const
virtual ~KColorScheme()
QColor shade(ShadeRole) const
QBrush foreground(ForegroundRole=NormalText) const
KStatefulBrushPrivate(const QBrush &brush)
QBrush brush(QPalette::ColorGroup) const
KStatefulBrush & operator=(const KStatefulBrush &)
class KStatefulBrushPrivate * d
double _amount[3]
QBrush brush(const QBrush &background) const
StateEffects(QPalette::ColorGroup state, const KSharedConfigPtr &)
static const SetDefaultColors defaultSelectionColors
static const SetDefaultColors defaultWindowColors
static const SetDefaultColors defaultTooltipColors
static const DecoDefaultColors defaultDecorationColors
static const SetDefaultColors defaultButtonColors
#define DECO_DEFAULT(a)
#define SET_DEFAULT(a)
static const SetDefaultColors defaultViewColors
rgba palette[MAX_PALETTE]
Definition palette.c:35