12void QQuickBasicTheme::initialize(QQuickTheme *theme)
14 QPalette systemPalette;
16 const bool isDarkSystemTheme = QQuickStylePrivate::isDarkSystemTheme();
18 const QRgb base(isDarkSystemTheme ? 0xFF000000 : 0xFFFFFFFF);
19 const QRgb disabledBase(isDarkSystemTheme ? 0xFF292929 : 0xFFD6D6D6);
20 const QRgb button(isDarkSystemTheme ? 0xFF2F2F2F : 0xFFE0E0E0);
21 const QRgb buttonText(isDarkSystemTheme ? 0xFFD4D6D8 : 0xFF26282A);
22 const QRgb disabledButtonText(isDarkSystemTheme ? 0x4DD4D6D8 : 0x4D26282A);
23 const QRgb brightText(isDarkSystemTheme ? 0xFF000000 : 0xFFFFFFFF);
24 const QRgb disabledBrightText(isDarkSystemTheme ? 0x4D000000 : 0x4DFFFFFF);
25 const QRgb dark(isDarkSystemTheme ? 0xFFC8C9CB : 0xFF353637);
26 const QRgb highlight(isDarkSystemTheme ? 0xFF0D69F2 : 0xFF0066FF);
27 const QRgb disabledHighlight(isDarkSystemTheme ? 0xFF01060F : 0xFFF0F6FF);
28 const QRgb highlightedText(isDarkSystemTheme ? 0xFFFDFDFD : 0xFF090909);
29 const QRgb light(isDarkSystemTheme ? 0xFF1A1A1A : 0xFFF6F6F6);
30 const QRgb link(isDarkSystemTheme ? 0xFF2F86B1 : 0xFF45A7D7);
31 const QRgb mid(isDarkSystemTheme ? 0xFF626262 : 0xFFBDBDBD);
32 const QRgb midlight(isDarkSystemTheme ? 0xFF2C2C2C : 0xFFE4E4E4);
33 const QRgb text(isDarkSystemTheme ? 0xFFEFF0F2 : 0xFF353637);
34 const QRgb disabledText(isDarkSystemTheme ? 0x7FC8C9CB : 0x7F353637);
35 const QRgb shadow(0xFF28282A);
36 const QRgb toolTipBase(isDarkSystemTheme ? 0xFF000000 : 0xFFFFFFFF);
37 const QRgb toolTipText(isDarkSystemTheme ? 0xFFFFFFFF : 0xFF000000);
38 const QRgb window(isDarkSystemTheme ? 0xFF000000 : 0xFFFFFFFF);
39 const QRgb windowText(isDarkSystemTheme ? 0xFFD4D6D8 : 0xFF26282A);
40 const QRgb disabledWindowText(isDarkSystemTheme ? 0xFF3F4040 : 0xFFBDBEBF);
41 const QRgb placeholderText(isDarkSystemTheme ? 0x88C8C9CB : 0x88353637);
43 systemPalette.setColor(QPalette::Base, QColor::fromRgba(base));
44 systemPalette.setColor(QPalette::Disabled, QPalette::Base, QColor::fromRgba(disabledBase));
46 systemPalette.setColor(QPalette::Button, QColor::fromRgba(button));
48 systemPalette.setColor(QPalette::ButtonText, QColor::fromRgba(buttonText));
49 systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText,
50 QColor::fromRgba(disabledButtonText));
52 systemPalette.setColor(QPalette::BrightText, QColor::fromRgba(brightText));
53 systemPalette.setColor(QPalette::Disabled, QPalette::BrightText,
54 QColor::fromRgba(disabledBrightText));
56 systemPalette.setColor(QPalette::Dark, QColor::fromRgba(dark));
58 systemPalette.setColor(QPalette::Highlight, QColor::fromRgba(highlight));
59 systemPalette.setColor(QPalette::Disabled, QPalette::Highlight,
60 QColor::fromRgba(disabledHighlight));
62 systemPalette.setColor(QPalette::HighlightedText, QColor::fromRgba(highlightedText));
64 systemPalette.setColor(QPalette::Light, QColor::fromRgba(light));
66 systemPalette.setColor(QPalette::Link, QColor::fromRgba(link));
68 systemPalette.setColor(QPalette::Mid, QColor::fromRgba(mid));
70 systemPalette.setColor(QPalette::Midlight, QColor::fromRgba(midlight));
72 systemPalette.setColor(QPalette::Text, QColor::fromRgba(text));
73 systemPalette.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgba(disabledText));
75 systemPalette.setColor(QPalette::Shadow, QColor::fromRgba(shadow));
77 systemPalette.setColor(QPalette::ToolTipBase, QColor::fromRgba(toolTipBase));
78 systemPalette.setColor(QPalette::ToolTipText, QColor::fromRgba(toolTipText));
80 systemPalette.setColor(QPalette::Window, QColor::fromRgba(window));
82 systemPalette.setColor(QPalette::WindowText, QColor::fromRgba(windowText));
83 systemPalette.setColor(QPalette::Disabled, QPalette::WindowText,
84 QColor::fromRgba(disabledWindowText));
86 systemPalette.setColor(QPalette::PlaceholderText, QColor::fromRgba(placeholderText));
88 theme->setPalette(QQuickTheme::System, systemPalette);