8#include "basictheme_p.h"
11#include <QGuiApplication>
14#include "libs/style.h"
15#include "imagecolors.h"
19 BasicThemeDefinition::BasicThemeDefinition(QObject *parent)
21 ,m_imgColors(new ImageColors(this))
24 auto style = Style::instance();
46 setTrueBlackColors(
true);
51 m_imgColors->setSource(style->adaptiveColorSchemeSource());
57 setSystemPaletteColors();
62 Q_EMIT this->changed();
65 connect(style, &Style::accentColorChanged, [
this, style](
QColor)
67 switch(style->styleType())
89 Q_EMIT this->changed();
92 connect(style, &Style::adaptiveColorSchemeSourceChanged, [
this, style](
QVariant source)
96 m_imgColors->setSource(source);
100 connect(m_imgColors, &ImageColors::paletteChanged, [
this, style]()
105 Q_EMIT this->changed();
113 setSystemPaletteColors();
114 Q_EMIT this->changed();
118 switch(style->styleType())
132 m_imgColors->setSource(style->adaptiveColorSchemeSource());
137 setTrueBlackColors();
142 setTrueBlackColors(
true);
148 setSystemPaletteColors();
155 void BasicThemeDefinition::setSystemPaletteColors()
159 textColor = palette.color(QPalette::ColorRole::WindowText);
160 disabledTextColor = palette.color(QPalette::ColorRole::PlaceholderText);
162 highlightColor = palette.color(QPalette::ColorRole::Highlight);
163 highlightedTextColor = palette.color(QPalette::ColorRole::HighlightedText);
165 backgroundColor = palette.color(QPalette::ColorRole::Window);
170 activeBackgroundColor = highlightColor;
171 alternateBackgroundColor = isDark ? palette.color(QPalette::ColorRole::AlternateBase).lighter(104) : palette.color(QPalette::ColorRole::AlternateBase).darker(104);
173 hoverColor = palette.color(isDark ? QPalette::ColorRole::Midlight : QPalette::ColorRole::Mid);
174 focusColor = highlightColor;
176 activeTextColor = highlightColor;
178 buttonTextColor = palette.color(QPalette::ColorRole::ButtonText);
179 buttonBackgroundColor = palette.color(QPalette::ColorRole::Button);
180 buttonAlternateBackgroundColor = isDark ? buttonBackgroundColor.lighter(104) : buttonBackgroundColor.darker(104);
181 buttonHoverColor = palette.color(isDark ? QPalette::ColorRole::Midlight : QPalette::ColorRole::Mid);
182 buttonFocusColor = highlightColor;
184 viewTextColor = palette.color(QPalette::ColorRole::Text);
185 viewBackgroundColor = palette.color(QPalette::ColorRole::Base);
186 viewAlternateBackgroundColor = isDark ? viewBackgroundColor.lighter(104) : viewBackgroundColor.darker(104);
187 viewHoverColor = palette.color(isDark ? QPalette::ColorRole::Midlight : QPalette::ColorRole::Mid);
188 viewFocusColor = highlightColor;
190 selectionTextColor = palette.color(QPalette::ColorRole::HighlightedText);
191 selectionBackgroundColor = highlightColor;
192 selectionAlternateBackgroundColor = isDark ? highlightColor.lighter() : highlightColor.darker();
193 selectionHoverColor = isDark ? highlightColor.darker() : highlightColor.lighter();
194 selectionFocusColor = highlightColor;
196 bool useDefaultColors =
true;
216 headerTextColor = textColor;
217 headerBackgroundColor = palette.color(QPalette::ColorRole::Window);
218 headerAlternateBackgroundColor =palette.color(QPalette::ColorRole::AlternateBase);
219 headerHoverColor =palette.color(QPalette::ColorRole::Light);
220 headerFocusColor = highlightColor;
224 complementaryTextColor = palette.color(QPalette::ColorRole::BrightText);
225 complementaryBackgroundColor = palette.color(QPalette::ColorRole::Shadow);
226 complementaryAlternateBackgroundColor = palette.color(QPalette::ColorRole::Dark);
227 complementaryHoverColor = palette.color(QPalette::ColorRole::Mid);
228 complementaryFocusColor = highlightColor;
230 linkColor = palette.color(QPalette::ColorRole::Link);
231 linkBackgroundColor = palette.color(QPalette::ColorRole::Light);
232 visitedLinkColor = palette.color(QPalette::ColorRole::LinkVisited);
233 visitedLinkBackgroundColor = palette.color(QPalette::ColorRole::Light);
235 negativeTextColor =
QColor{
"#dac7cb"};
236 negativeBackgroundColor =
QColor{
"#DA4453"};
237 neutralTextColor =
QColor{
"#fafafa"};
238 neutralBackgroundColor =
QColor{
"#F67400"};
239 positiveTextColor =
QColor{
"#fafafa"};
240 positiveBackgroundColor =
QColor{
"#27AE60"};
242 tooltipTextColor =
QColor{
"#fafafa"};
243 tooltipBackgroundColor =
QColor{
"#333"};
244 tooltipAlternateBackgroundColor = tooltipBackgroundColor.
darker();
245 tooltipHoverColor =
QColor{
"#000"};
246 tooltipFocusColor =
QColor{
"#000"};
249 void BasicThemeDefinition::setTrueBlackColors(
bool inverted )
254 textColor = inverted ? color2 :
color1;
255 disabledTextColor = textColor;
257 highlightColor = inverted ? color2 :
color1;
258 highlightedTextColor = inverted ?
color1 : color2;
260 backgroundColor = inverted ?
color1 : color2;
261 activeBackgroundColor = highlightColor;
262 alternateBackgroundColor = backgroundColor;
263 hoverColor = backgroundColor;
264 focusColor = highlightColor;
266 activeTextColor = highlightColor;
268 buttonTextColor = textColor;
269 buttonBackgroundColor = backgroundColor;
270 buttonAlternateBackgroundColor = buttonBackgroundColor;
271 buttonHoverColor = buttonBackgroundColor;
272 buttonFocusColor = buttonBackgroundColor;
274 viewTextColor = textColor;
275 viewBackgroundColor = backgroundColor;
276 viewAlternateBackgroundColor = viewBackgroundColor;
277 viewHoverColor = viewBackgroundColor;
278 viewFocusColor = highlightColor;
280 selectionTextColor = highlightedTextColor;
281 selectionBackgroundColor = highlightColor;
282 selectionAlternateBackgroundColor = selectionBackgroundColor;
283 selectionHoverColor = selectionBackgroundColor;
284 selectionFocusColor = highlightColor;
286 complementaryTextColor = highlightedTextColor;
287 complementaryBackgroundColor = highlightColor;
288 complementaryAlternateBackgroundColor = complementaryBackgroundColor;
289 complementaryHoverColor = complementaryBackgroundColor;
290 complementaryFocusColor = highlightColor;
292 headerTextColor = textColor;
293 headerBackgroundColor = backgroundColor;
294 headerAlternateBackgroundColor = headerBackgroundColor;
295 headerHoverColor = headerBackgroundColor;
296 headerFocusColor = highlightColor;
298 linkColor =
QColor{
"#21b9ff"};
299 linkBackgroundColor =
QColor{
"#21b9ff"};
300 visitedLinkColor =
QColor{
"#ff17d4"};
301 visitedLinkBackgroundColor =
QColor{
"#ff17d4"};
303 negativeTextColor =
QColor{
"#DA4453"};
304 negativeBackgroundColor = backgroundColor;
305 neutralTextColor =
QColor{
"#F67400"};
306 neutralBackgroundColor = backgroundColor;
307 positiveTextColor =
QColor{
"#27AE60"};
308 positiveBackgroundColor = backgroundColor;
310 tooltipTextColor = textColor;
311 tooltipBackgroundColor = backgroundColor;
312 tooltipAlternateBackgroundColor = tooltipBackgroundColor;
313 tooltipHoverColor = tooltipBackgroundColor;
314 tooltipFocusColor = tooltipBackgroundColor;
317 void BasicThemeDefinition::setDarkColors()
321 textColor = DarkColor::textColor;
322 disabledTextColor = DarkColor::disabledTextColor;
324 highlightColor = Style::instance()->accentColor();
327 highlightedTextColor = isDark ?
QColor{
"#eff0f1"} :
QColor{
"#232323"};
329 backgroundColor = cu.
tintWithAlpha(DarkColor::backgroundColor, highlightColor, 0.02);
330 activeBackgroundColor = highlightColor;
331 alternateBackgroundColor = cu.
tintWithAlpha(DarkColor::alternateBackgroundColor, highlightColor, 0.02);
332 hoverColor = cu.
tintWithAlpha(DarkColor::hoverColor, highlightColor, 0.02);
333 focusColor = highlightColor;
335 activeTextColor = highlightColor;
337 buttonTextColor = textColor;
338 buttonBackgroundColor = cu.
tintWithAlpha(DarkColor::buttonBackgroundColor, highlightColor, 0.02);
339 buttonAlternateBackgroundColor = cu.
tintWithAlpha(DarkColor::buttonAlternateBackgroundColor, highlightColor, 0.02);
340 buttonHoverColor = cu.
tintWithAlpha(DarkColor::buttonHoverColor, highlightColor, 0.02);
341 buttonFocusColor = highlightColor;
343 viewTextColor = textColor;
344 viewBackgroundColor = cu.
tintWithAlpha(DarkColor::viewBackgroundColor, highlightColor, 0.02);
345 viewAlternateBackgroundColor = cu.
tintWithAlpha(DarkColor::viewAlternateBackgroundColor, highlightColor, 0.02);
346 viewHoverColor = cu.
tintWithAlpha(DarkColor::viewHoverColor, highlightColor, 0.02);
347 viewFocusColor = highlightColor;
349 selectionTextColor =
QColor{
"#fcfcfc"};
350 selectionBackgroundColor = highlightColor;
351 selectionAlternateBackgroundColor = selectionBackgroundColor.
darker();
352 selectionHoverColor = selectionBackgroundColor.
lighter();
353 selectionFocusColor = highlightColor;
355 complementaryTextColor =
QColor{
"#eff0f1"};
357 complementaryAlternateBackgroundColor = complementaryBackgroundColor.
darker();
358 complementaryHoverColor = complementaryBackgroundColor.
lighter();
359 complementaryFocusColor = highlightColor;
361 headerTextColor = textColor;
362 headerBackgroundColor = cu.
tintWithAlpha(DarkColor::headerBackgroundColor, highlightColor, 0.04);
363 headerAlternateBackgroundColor = cu.
tintWithAlpha(DarkColor::headerAlternateBackgroundColor, highlightColor, 0.02);
364 headerHoverColor = DarkColor::hoverColor;
365 headerFocusColor = highlightColor;
367 linkColor =
QColor{
"#21b9ff"};
368 linkBackgroundColor =
QColor{
"#21b9ff"};
369 visitedLinkColor =
QColor{
"#ff17d4"};
370 visitedLinkBackgroundColor =
QColor{
"#ff17d4"};
372 negativeTextColor =
QColor{
"#fafafa"};
373 negativeBackgroundColor =
QColor{
"#DA4453"};
374 neutralTextColor =
QColor{
"#fafafa"};
375 neutralBackgroundColor =
QColor{
"#F67400"};
376 positiveTextColor =
QColor{
"#fafafa"};
377 positiveBackgroundColor =
QColor{
"#27AE60"};
379 tooltipTextColor =
QColor{
"#fafafa"};
380 tooltipBackgroundColor =
QColor{
"#333"};
381 tooltipAlternateBackgroundColor = tooltipBackgroundColor.
darker();
382 tooltipHoverColor =
QColor{
"#000"};
383 tooltipFocusColor =
QColor{
"#000"};
386 void BasicThemeDefinition::setLightColors()
390 textColor = LightColor::textColor;
391 disabledTextColor = LightColor::disabledTextColor;
393 highlightColor = Style::instance()->accentColor();
396 highlightedTextColor = isDark ?
QColor{
"#eff0f1"} :
QColor{
"#232323"};
398 backgroundColor = cu.
tintWithAlpha(LightColor::backgroundColor, highlightColor, 0.02);
399 activeBackgroundColor = highlightColor;
400 alternateBackgroundColor = cu.
tintWithAlpha(LightColor::alternateBackgroundColor, highlightColor, 0.02);
402 hoverColor = LightColor::hoverColor;
403 focusColor = highlightColor;
405 activeTextColor = highlightColor;
407 buttonTextColor = textColor;
408 buttonBackgroundColor = cu.
tintWithAlpha(LightColor::buttonBackgroundColor, highlightColor, 0.03);
409 buttonAlternateBackgroundColor = LightColor::buttonAlternateBackgroundColor;
410 buttonHoverColor = cu.
tintWithAlpha(LightColor::buttonHoverColor, highlightColor, 0.02);
411 buttonFocusColor = highlightColor;
413 viewTextColor =
QColor{
"#333333"};
414 viewBackgroundColor = cu.
tintWithAlpha(LightColor::viewBackgroundColor, highlightColor, 0.02);
415 viewAlternateBackgroundColor =cu.
tintWithAlpha(LightColor::viewAlternateBackgroundColor, highlightColor, 0.02);
416 viewHoverColor = cu.
tintWithAlpha(LightColor::viewHoverColor, highlightColor, 0.02);
417 viewFocusColor = highlightColor;
419 selectionTextColor =
QColor{
"#eff0f1"};
420 selectionBackgroundColor = highlightColor;
421 selectionAlternateBackgroundColor = selectionBackgroundColor.
darker(120);
422 selectionHoverColor = selectionBackgroundColor.
lighter(120);
423 selectionFocusColor = highlightColor;
425 complementaryTextColor =
QColor{
"#eff0f1"};
427 complementaryAlternateBackgroundColor = complementaryBackgroundColor.
darker(120);
428 complementaryHoverColor = complementaryBackgroundColor.
lighter(120);
429 complementaryFocusColor = highlightColor;
431 headerTextColor = textColor;
432 headerBackgroundColor = cu.
tintWithAlpha(LightColor::headerBackgroundColor, highlightColor, 0.04);
433 headerAlternateBackgroundColor = cu.
tintWithAlpha(LightColor::headerAlternateBackgroundColor, highlightColor, 0.02);
434 headerHoverColor = LightColor::hoverColor;
435 headerFocusColor = highlightColor;
437 linkColor =
QColor{
"#21b9ff"};
438 linkBackgroundColor =
QColor{
"#21b9ff"};
439 visitedLinkColor =
QColor{
"#ff17d4"};
440 visitedLinkBackgroundColor =
QColor{
"#ff17d4"};
442 negativeTextColor =
QColor{
"#fafafa"};
443 negativeBackgroundColor =
QColor{
"#DA4453"};
444 neutralTextColor =
QColor{
"#fafafa"};
445 neutralBackgroundColor =
QColor{
"#F67400"};
446 positiveTextColor =
QColor{
"#fafafa"};
447 positiveBackgroundColor =
QColor{
"#27AE60"};
449 tooltipTextColor =
QColor{
"#fafafa"};
450 tooltipBackgroundColor =
QColor{
"#333"};
451 tooltipAlternateBackgroundColor = tooltipBackgroundColor.
darker();
452 tooltipHoverColor =
QColor{
"#000"};
453 tooltipFocusColor =
QColor{
"#000"};
456 void BasicThemeDefinition::setAdaptiveColors()
460 textColor = m_imgColors->foreground();
461 disabledTextColor = textColor.lighter(120);
463 highlightColor = m_imgColors->highlight();
466 const auto bgColor = cu.
tintWithAlpha(isDark ? DarkColor::backgroundColor : LightColor::backgroundColor, m_imgColors->background(), 0.1);
467 const auto btnColor = cu.
tintWithAlpha(isDark ? DarkColor::buttonBackgroundColor : LightColor::buttonBackgroundColor, highlightColor, 0.06);
471 backgroundColor = cu.
tintWithAlpha(bgColor, highlightColor, 0.03);
472 activeBackgroundColor = highlightColor;
473 alternateBackgroundColor = cu.
tintWithAlpha(backgroundColor, highlightColor, 0.02);
475 hoverColor = cu.
tintWithAlpha(isDark ? DarkColor::hoverColor : LightColor::hoverColor, highlightColor, 0.02);
477 focusColor = highlightColor;
479 activeTextColor = highlightColor;
481 buttonTextColor = textColor;
482 buttonBackgroundColor = btnColor;
483 buttonAlternateBackgroundColor = cu.
tintWithAlpha(isDark ? DarkColor::buttonBackgroundColor : LightColor::buttonBackgroundColor, highlightColor, 0.03);
484 buttonHoverColor = cu.
tintWithAlpha(isDark ? DarkColor::buttonHoverColor : LightColor::buttonHoverColor, highlightColor, 0.03);
485 buttonFocusColor = highlightColor;
487 viewTextColor = textColor;
488 viewBackgroundColor = cu.
tintWithAlpha(isDark ? DarkColor::viewBackgroundColor : LightColor::viewBackgroundColor, highlightColor, 0.07);
489 viewAlternateBackgroundColor = cu.
tintWithAlpha(isDark ? DarkColor::viewAlternateBackgroundColor : LightColor::viewAlternateBackgroundColor, highlightColor, 0.03);
490 viewHoverColor = cu.
tintWithAlpha(isDark ? DarkColor::viewHoverColor : LightColor::viewHoverColor, highlightColor, 0.03);
491 viewFocusColor = highlightColor;
493 selectionTextColor =
QColor{
"#fcfcfc"};
494 selectionBackgroundColor = highlightColor;
495 selectionAlternateBackgroundColor = selectionBackgroundColor.
darker();
496 selectionHoverColor = selectionBackgroundColor.
lighter();
497 selectionFocusColor = highlightColor;
499 complementaryTextColor =
QColor{
"#eff0f1"};
501 complementaryAlternateBackgroundColor = complementaryBackgroundColor.
darker();
502 complementaryHoverColor = complementaryBackgroundColor.
lighter();
503 complementaryFocusColor = highlightColor;
505 headerTextColor = textColor;
506 headerBackgroundColor = cu.
tintWithAlpha(bgColor, highlightColor, 0.05);
507 headerAlternateBackgroundColor = headerBackgroundColor.
darker();
508 headerAlternateBackgroundColor = cu.
tintWithAlpha(bgColor, highlightColor, 0.02);
510 headerHoverColor = headerBackgroundColor.
lighter();
511 headerFocusColor = highlightColor;
513 linkColor =
QColor{
"#2980B9"};
514 linkBackgroundColor =
QColor{
"#2980B9"};
515 visitedLinkColor =
QColor{
"#7F8C8D"};
516 visitedLinkBackgroundColor =
QColor{
"#2196F3"};
518 negativeTextColor =
QColor{
"#dac7cb"};
519 negativeBackgroundColor =
QColor{
"#DA4453"};
520 neutralTextColor =
QColor{
"#fafafa"};
521 neutralBackgroundColor =
QColor{
"#F67400"};
522 positiveTextColor =
QColor{
"#fafafa"};
523 positiveBackgroundColor =
QColor{
"#27AE60"};
525 tooltipTextColor =
QColor{
"#fafafa"};
526 tooltipBackgroundColor =
QColor{
"#333"};
527 tooltipAlternateBackgroundColor = tooltipBackgroundColor.
darker();
528 tooltipHoverColor =
QColor{
"#000"};
529 tooltipFocusColor =
QColor{
"#000"};
532 void BasicThemeDefinition::syncToQml(PlatformTheme *
object)
534 auto item = qobject_cast<QQuickItem *>(object->parent());
535 if (item && qmlAttachedPropertiesObject<PlatformTheme>(item,
false) ==
object) {
540 BasicThemeInstance::BasicThemeInstance(
QObject *parent)
545 BasicThemeDefinition &BasicThemeInstance::themeDefinition(
QQmlEngine *engine)
547 if (m_themeDefinition) {
548 return *m_themeDefinition;
551 m_themeDefinition = std::make_unique<BasicThemeDefinition>();
553 connect(m_themeDefinition.get(), &BasicThemeDefinition::changed,
this, &BasicThemeInstance::onDefinitionChanged);
555 return *m_themeDefinition;
558 void BasicThemeInstance::onDefinitionChanged()
560 for (
auto watcher : std::as_const(watchers))
566 Q_GLOBAL_STATIC(BasicThemeInstance, basicThemeInstance)
568 BasicTheme::BasicTheme(
QObject *parent)
569 : PlatformTheme(parent)
571 basicThemeInstance()->watchers.append(
this);
576 BasicTheme::~BasicTheme()
578 basicThemeInstance()->watchers.removeOne(
this);
581 void BasicTheme::sync()
583 auto &definition = basicThemeInstance()->themeDefinition(qmlEngine(parent()));
585 switch (colorSet()) {
586 case BasicTheme::Button:
587 setTextColor(
tint(definition.buttonTextColor));
588 setBackgroundColor(
tint(definition.buttonBackgroundColor));
589 setAlternateBackgroundColor(
tint(definition.buttonAlternateBackgroundColor));
590 setHoverColor(
tint(definition.buttonHoverColor));
591 setFocusColor(
tint(definition.buttonFocusColor));
593 case BasicTheme::View:
594 setTextColor(
tint(definition.viewTextColor));
595 setBackgroundColor(
tint(definition.viewBackgroundColor));
596 setAlternateBackgroundColor(
tint(definition.viewAlternateBackgroundColor));
597 setHoverColor(
tint(definition.viewHoverColor));
598 setFocusColor(
tint(definition.viewFocusColor));
600 case BasicTheme::Selection:
601 setTextColor(
tint(definition.selectionTextColor));
602 setBackgroundColor(
tint(definition.selectionBackgroundColor));
603 setAlternateBackgroundColor(
tint(definition.selectionAlternateBackgroundColor));
604 setHoverColor(
tint(definition.selectionHoverColor));
605 setFocusColor(
tint(definition.selectionFocusColor));
607 case BasicTheme::Tooltip:
608 setTextColor(
tint(definition.tooltipTextColor));
609 setBackgroundColor(
tint(definition.tooltipBackgroundColor));
610 setAlternateBackgroundColor(
tint(definition.tooltipAlternateBackgroundColor));
611 setHoverColor(
tint(definition.tooltipHoverColor));
612 setFocusColor(
tint(definition.tooltipFocusColor));
614 case BasicTheme::Complementary:
615 setTextColor(
tint(definition.complementaryTextColor));
616 setBackgroundColor(
tint(definition.complementaryBackgroundColor));
617 setAlternateBackgroundColor(
tint(definition.complementaryAlternateBackgroundColor));
618 setHoverColor(
tint(definition.complementaryHoverColor));
619 setFocusColor(
tint(definition.complementaryFocusColor));
621 case BasicTheme::Header:
622 setTextColor(
tint(definition.headerTextColor));
623 setBackgroundColor(
tint(definition.headerBackgroundColor));
624 setAlternateBackgroundColor(
tint(definition.headerAlternateBackgroundColor));
625 setHoverColor(
tint(definition.headerHoverColor));
626 setFocusColor(
tint(definition.headerFocusColor));
628 case BasicTheme::Window:
630 setTextColor(
tint(definition.textColor));
631 setBackgroundColor(
tint(definition.backgroundColor));
632 setAlternateBackgroundColor(
tint(definition.alternateBackgroundColor));
633 setHoverColor(
tint(definition.hoverColor));
634 setFocusColor(
tint(definition.focusColor));
638 setDisabledTextColor(
tint(definition.disabledTextColor));
639 setHighlightColor(
tint(definition.highlightColor));
640 setHighlightedTextColor(
tint(definition.highlightedTextColor));
641 setActiveTextColor(
tint(definition.activeTextColor));
642 setActiveBackgroundColor(
tint(definition.activeBackgroundColor));
643 setLinkColor(
tint(definition.linkColor));
644 setLinkBackgroundColor(
tint(definition.linkBackgroundColor));
645 setVisitedLinkColor(
tint(definition.visitedLinkColor));
646 setVisitedLinkBackgroundColor(
tint(definition.visitedLinkBackgroundColor));
647 setNegativeTextColor(
tint(definition.negativeTextColor));
648 setNegativeBackgroundColor(
tint(definition.negativeBackgroundColor));
649 setNeutralTextColor(
tint(definition.neutralTextColor));
650 setNeutralBackgroundColor(
tint(definition.neutralBackgroundColor));
651 setPositiveTextColor(
tint(definition.positiveTextColor));
652 setPositiveBackgroundColor(
tint(definition.positiveBackgroundColor));
655 bool BasicTheme::event(
QEvent *event)
657 if (
event->type() == PlatformThemeEvents::DataChangedEvent::type) {
661 if (
event->type() == PlatformThemeEvents::ColorSetChangedEvent::type) {
665 if (
event->type() == PlatformThemeEvents::ColorGroupChangedEvent::type) {
669 if (
event->type() == PlatformThemeEvents::ColorChangedEvent::type) {
670 basicThemeInstance()->themeDefinition(qmlEngine(parent())).syncToQml(
this);
673 if (
event->type() == PlatformThemeEvents::FontChangedEvent::type) {
674 basicThemeInstance()->themeDefinition(qmlEngine(parent())).syncToQml(
this);
677 return PlatformTheme::event(event);
682 switch (colorGroup()) {
683 case PlatformTheme::Inactive:
685 case PlatformTheme::Disabled:
Utilities for processing items to obtain colors and information useful for UIs that need to adjust to...
Q_INVOKABLE QColor tintWithAlpha(const QColor &targetColor, const QColor &tintColor, double alpha)
Tint a color using a separate alpha value.
Q_INVOKABLE ColorUtils::Brightness brightnessForColor(const QColor &color)
Returns whether a color is bright or dark.
@ Dark
The item is dark and requires a light foreground color to achieve readable contrast.
StyleType
The different options for the color scheme style.
@ TrueBlack
A fully black color palette with a full white accent color.
@ Inverted
A fully white color palette with a true black accent color.
@ Light
A light variant designed for Maui.
@ Dark
A dark variant designed for Maui.
@ Auto
Picks the colors from the system palette, usually from Plasma color-scheme files.
@ Adaptive
Picks the color scheme based on an source input, such as an image.
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
KGUIADDONS_EXPORT QColor tint(const QColor &base, const QColor &color, qreal amount=0.3)
QColor darker(int factor) const const
QColor fromHsvF(float h, float s, float v, float a)
QColor lighter(int factor) const const
float saturationF() const const
float valueF() const const
void paletteChanged(const QPalette &palette)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)