2026-03-26 10:45:29 +08:00
|
|
|
#include "APP/APP_Theme.h"
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QFontDatabase>
|
|
|
|
|
#include <QtWidgets/QApplication>
|
|
|
|
|
|
|
|
|
|
namespace APP {
|
|
|
|
|
|
|
|
|
|
QPalette APP_Theme::App_Func_GetPalette()
|
|
|
|
|
{
|
|
|
|
|
QPalette Palette;
|
|
|
|
|
|
|
|
|
|
const QColor WindowColor(20, 25, 33);
|
|
|
|
|
const QColor BaseColor(28, 34, 42);
|
|
|
|
|
const QColor AltBaseColor(34, 40, 49);
|
|
|
|
|
const QColor ButtonColor(38, 44, 54);
|
|
|
|
|
const QColor BorderHintColor(86, 96, 108);
|
|
|
|
|
const QColor HighlightColor(72, 184, 162);
|
|
|
|
|
const QColor TextColor(238, 242, 247);
|
|
|
|
|
const QColor DimTextColor(162, 170, 182);
|
|
|
|
|
|
|
|
|
|
Palette.setColor(QPalette::Window, WindowColor);
|
|
|
|
|
Palette.setColor(QPalette::WindowText, TextColor);
|
|
|
|
|
Palette.setColor(QPalette::Base, BaseColor);
|
|
|
|
|
Palette.setColor(QPalette::AlternateBase, AltBaseColor);
|
|
|
|
|
Palette.setColor(QPalette::Text, TextColor);
|
|
|
|
|
Palette.setColor(QPalette::Button, ButtonColor);
|
|
|
|
|
Palette.setColor(QPalette::ButtonText, TextColor);
|
|
|
|
|
Palette.setColor(QPalette::BrightText, QColor(255, 255, 255));
|
|
|
|
|
Palette.setColor(QPalette::Light, BorderHintColor.lighter(120));
|
|
|
|
|
Palette.setColor(QPalette::Midlight, BorderHintColor);
|
|
|
|
|
Palette.setColor(QPalette::Mid, BorderHintColor.darker(120));
|
|
|
|
|
Palette.setColor(QPalette::Dark, WindowColor.darker(140));
|
|
|
|
|
Palette.setColor(QPalette::Shadow, QColor(0, 0, 0, 140));
|
|
|
|
|
Palette.setColor(QPalette::Highlight, HighlightColor);
|
|
|
|
|
Palette.setColor(QPalette::HighlightedText, TextColor);
|
|
|
|
|
Palette.setColor(QPalette::ToolTipBase, BaseColor);
|
|
|
|
|
Palette.setColor(QPalette::ToolTipText, TextColor);
|
|
|
|
|
Palette.setColor(QPalette::Link, QColor(103, 146, 224));
|
|
|
|
|
Palette.setColor(QPalette::PlaceholderText, QColor(170, 178, 188, 170));
|
|
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::WindowText, DimTextColor);
|
|
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::Text, DimTextColor);
|
|
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::ButtonText, DimTextColor);
|
2026-04-17 16:25:19 +08:00
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::Base, QColor(30, 35, 43));
|
|
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::Button, QColor(34, 40, 49));
|
|
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::Window, QColor(24, 29, 36));
|
|
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(60, 68, 78));
|
|
|
|
|
Palette.setColor(QPalette::Disabled, QPalette::HighlightedText, DimTextColor);
|
2026-03-26 10:45:29 +08:00
|
|
|
|
|
|
|
|
return Palette;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 16:25:19 +08:00
|
|
|
QString APP_Theme::App_Func_GetStyleSheet()
|
|
|
|
|
{
|
|
|
|
|
return QStringLiteral(R"(
|
|
|
|
|
QWidget {
|
|
|
|
|
color: #eef2f7;
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
}
|
|
|
|
|
QTabWidget::pane {
|
|
|
|
|
border: 0;
|
|
|
|
|
background: transparent;
|
|
|
|
|
}
|
|
|
|
|
QTabBar::tab {
|
|
|
|
|
background: rgba(56, 64, 76, 0.78);
|
|
|
|
|
color: #b9c3cf;
|
|
|
|
|
border: 1px solid #5d6a78;
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
border-top-left-radius: 10px;
|
|
|
|
|
border-top-right-radius: 10px;
|
|
|
|
|
padding: 8px 18px;
|
|
|
|
|
margin-right: 6px;
|
|
|
|
|
min-width: 92px;
|
|
|
|
|
}
|
|
|
|
|
QTabBar::tab:selected {
|
|
|
|
|
background: #2d3742;
|
|
|
|
|
color: #f7fbff;
|
|
|
|
|
}
|
|
|
|
|
QTabBar::tab:hover:!selected {
|
|
|
|
|
background: #394553;
|
|
|
|
|
color: #eff4f8;
|
|
|
|
|
}
|
|
|
|
|
QPushButton {
|
|
|
|
|
background: #303947;
|
|
|
|
|
color: #eff4f8;
|
|
|
|
|
border: 1px solid #667587;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
padding: 8px 14px;
|
|
|
|
|
min-height: 18px;
|
|
|
|
|
}
|
|
|
|
|
QPushButton:hover {
|
|
|
|
|
background: #384354;
|
|
|
|
|
border-color: #7b8da1;
|
|
|
|
|
}
|
|
|
|
|
QPushButton:pressed {
|
|
|
|
|
background: #25303b;
|
|
|
|
|
}
|
|
|
|
|
QPushButton:disabled {
|
|
|
|
|
background: #252c35;
|
|
|
|
|
color: #7d8794;
|
|
|
|
|
border-color: #414b58;
|
|
|
|
|
}
|
|
|
|
|
QLineEdit,
|
|
|
|
|
QPlainTextEdit,
|
|
|
|
|
QTableWidget,
|
|
|
|
|
QComboBox,
|
|
|
|
|
QSpinBox {
|
|
|
|
|
background: #1d242d;
|
|
|
|
|
color: #edf3f8;
|
|
|
|
|
border: 1px solid #4f5d6d;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
selection-background-color: #48b8a2;
|
|
|
|
|
selection-color: #102022;
|
|
|
|
|
}
|
|
|
|
|
QLineEdit,
|
|
|
|
|
QComboBox,
|
|
|
|
|
QSpinBox {
|
|
|
|
|
padding: 6px 8px;
|
|
|
|
|
}
|
|
|
|
|
QPlainTextEdit,
|
|
|
|
|
QTableWidget {
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
}
|
|
|
|
|
QHeaderView::section {
|
|
|
|
|
background: #313b49;
|
|
|
|
|
color: #d8e0e8;
|
|
|
|
|
border: none;
|
|
|
|
|
border-bottom: 1px solid #4f5d6d;
|
|
|
|
|
padding: 7px 8px;
|
|
|
|
|
}
|
|
|
|
|
QTableCornerButton::section {
|
|
|
|
|
background: #313b49;
|
|
|
|
|
border: none;
|
|
|
|
|
border-bottom: 1px solid #4f5d6d;
|
|
|
|
|
}
|
|
|
|
|
QTableWidget {
|
|
|
|
|
alternate-background-color: #232b35;
|
|
|
|
|
gridline-color: #2f3945;
|
|
|
|
|
}
|
|
|
|
|
QTableWidget::item {
|
|
|
|
|
padding: 4px 6px;
|
|
|
|
|
}
|
|
|
|
|
QScrollBar:vertical {
|
|
|
|
|
background: transparent;
|
|
|
|
|
width: 10px;
|
|
|
|
|
margin: 4px 0 4px 0;
|
|
|
|
|
}
|
|
|
|
|
QScrollBar::handle:vertical {
|
|
|
|
|
background: #53606f;
|
|
|
|
|
min-height: 28px;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
QScrollBar::add-line:vertical,
|
|
|
|
|
QScrollBar::sub-line:vertical,
|
|
|
|
|
QScrollBar::add-page:vertical,
|
|
|
|
|
QScrollBar::sub-page:vertical {
|
|
|
|
|
background: transparent;
|
|
|
|
|
height: 0;
|
|
|
|
|
}
|
|
|
|
|
QMenu {
|
|
|
|
|
background: #1f262f;
|
|
|
|
|
color: #eef2f7;
|
|
|
|
|
border: 1px solid #53606f;
|
|
|
|
|
padding: 6px;
|
|
|
|
|
}
|
|
|
|
|
QMenu::item {
|
|
|
|
|
padding: 7px 14px;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
}
|
|
|
|
|
QMenu::item:selected {
|
|
|
|
|
background: #33404d;
|
|
|
|
|
}
|
|
|
|
|
)");
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-26 10:45:29 +08:00
|
|
|
QFont APP_Theme::App_Func_GetBodyFont()
|
|
|
|
|
{
|
|
|
|
|
QFont Font(App_Func_PickFontFamily(QStringList()
|
|
|
|
|
<< QStringLiteral("Segoe UI Variable Text")
|
|
|
|
|
<< QStringLiteral("Microsoft YaHei UI")
|
|
|
|
|
<< QStringLiteral("Segoe UI")
|
|
|
|
|
<< QStringLiteral("Bahnschrift")));
|
|
|
|
|
Font.setPointSize(10);
|
|
|
|
|
Font.setWeight(QFont::Medium);
|
|
|
|
|
return Font;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QFont APP_Theme::App_Func_GetMetricFont()
|
|
|
|
|
{
|
|
|
|
|
QFont Font(App_Func_PickFontFamily(QStringList()
|
|
|
|
|
<< QStringLiteral("Bahnschrift SemiBold")
|
|
|
|
|
<< QStringLiteral("Segoe UI Semibold")
|
|
|
|
|
<< QStringLiteral("Microsoft YaHei UI")));
|
|
|
|
|
Font.setPointSize(12);
|
|
|
|
|
Font.setWeight(QFont::DemiBold);
|
|
|
|
|
return Font;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QFont APP_Theme::App_Func_GetKeyLabelFont()
|
|
|
|
|
{
|
|
|
|
|
QFont Font(App_Func_PickFontFamily(QStringList()
|
|
|
|
|
<< QStringLiteral("Bahnschrift SemiBold")
|
|
|
|
|
<< QStringLiteral("Segoe UI Semibold")
|
|
|
|
|
<< QStringLiteral("Microsoft YaHei UI")));
|
|
|
|
|
Font.setPointSize(22);
|
|
|
|
|
return Font;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QFont APP_Theme::App_Func_GetKeyHintFont()
|
|
|
|
|
{
|
|
|
|
|
QFont Font(App_Func_PickFontFamily(QStringList()
|
|
|
|
|
<< QStringLiteral("Segoe UI Semibold")
|
|
|
|
|
<< QStringLiteral("Bahnschrift SemiBold")
|
|
|
|
|
<< QStringLiteral("Microsoft YaHei UI")));
|
|
|
|
|
Font.setPointSize(8);
|
|
|
|
|
Font.setLetterSpacing(QFont::AbsoluteSpacing, 1.0);
|
|
|
|
|
return Font;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString APP_Theme::App_Func_PickFontFamily(const QStringList& FamilyList)
|
|
|
|
|
{
|
|
|
|
|
const QFontDatabase Database;
|
|
|
|
|
const QStringList AvailableFamilyList = Database.families();
|
|
|
|
|
|
2026-04-17 16:25:19 +08:00
|
|
|
for (const QString& Family : FamilyList)
|
2026-03-26 10:45:29 +08:00
|
|
|
{
|
|
|
|
|
if (AvailableFamilyList.contains(Family))
|
|
|
|
|
{
|
|
|
|
|
return Family;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QApplication::font().family();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace APP
|