190 lines
5.4 KiB
Python
190 lines
5.4 KiB
Python
from __future__ import annotations
|
|
|
|
from app.qt_compat import QApplication, QColor, QFont, QPalette
|
|
|
|
|
|
def apply_dark_theme(app: QApplication) -> None:
|
|
app.setStyle("Fusion")
|
|
font = QFont(app.font())
|
|
if font.pointSizeF() < 11.5:
|
|
font.setPointSizeF(11.5)
|
|
if hasattr(font, "setFamilies"):
|
|
font.setFamilies(["Segoe UI Variable Text", "Segoe UI", "Bahnschrift"])
|
|
else:
|
|
font.setFamily("Segoe UI")
|
|
app.setFont(font)
|
|
|
|
palette = QPalette()
|
|
palette.setColor(QPalette.Window, QColor("#1E1E1E"))
|
|
palette.setColor(QPalette.WindowText, QColor("#CCCCCC"))
|
|
palette.setColor(QPalette.Base, QColor("#252526"))
|
|
palette.setColor(QPalette.AlternateBase, QColor("#2D2D30"))
|
|
palette.setColor(QPalette.ToolTipBase, QColor("#252526"))
|
|
palette.setColor(QPalette.ToolTipText, QColor("#CCCCCC"))
|
|
palette.setColor(QPalette.Text, QColor("#CCCCCC"))
|
|
palette.setColor(QPalette.Button, QColor("#2D2D30"))
|
|
palette.setColor(QPalette.ButtonText, QColor("#CCCCCC"))
|
|
palette.setColor(QPalette.Highlight, QColor("#007ACC"))
|
|
palette.setColor(QPalette.HighlightedText, QColor("#FFFFFF"))
|
|
palette.setColor(QPalette.BrightText, QColor("#FFFFFF"))
|
|
palette.setColor(QPalette.PlaceholderText, QColor("#7A7A7A"))
|
|
app.setPalette(palette)
|
|
|
|
app.setStyleSheet(
|
|
"""
|
|
QWidget {
|
|
background: #1E1E1E;
|
|
color: #CCCCCC;
|
|
}
|
|
QMainWindow, QDialog {
|
|
background: #1E1E1E;
|
|
}
|
|
QToolBar {
|
|
background: #2D2D30;
|
|
border: none;
|
|
border-bottom: 1px solid #3C3C3C;
|
|
spacing: 4px;
|
|
padding: 4px 6px;
|
|
}
|
|
QToolButton {
|
|
background: transparent;
|
|
color: #CCCCCC;
|
|
border: 1px solid transparent;
|
|
border-radius: 3px;
|
|
padding: 6px 10px;
|
|
margin: 0 1px;
|
|
}
|
|
QToolButton:hover {
|
|
background: #37373D;
|
|
border-color: #37373D;
|
|
}
|
|
QToolButton:pressed, QToolButton:checked {
|
|
background: #094771;
|
|
border-color: #007ACC;
|
|
color: #FFFFFF;
|
|
}
|
|
QStatusBar {
|
|
background: #007ACC;
|
|
color: #FFFFFF;
|
|
}
|
|
QStatusBar QLabel {
|
|
background: transparent;
|
|
color: #FFFFFF;
|
|
padding: 0 4px;
|
|
}
|
|
QWidget#sectionHeader {
|
|
background: transparent;
|
|
border: none;
|
|
}
|
|
QLabel#sectionHeaderLabel {
|
|
background: transparent;
|
|
color: #CCCCCC;
|
|
font-size: 26px;
|
|
font-weight: 600;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
QWidget#sectionBody {
|
|
background: #252526;
|
|
border: 1px solid #3C3C3C;
|
|
border-radius: 0;
|
|
}
|
|
QGroupBox {
|
|
background: #252526;
|
|
border: 1px solid #3C3C3C;
|
|
border-radius: 0;
|
|
margin-top: 30px;
|
|
font-weight: 600;
|
|
padding: 10px 12px 12px 12px;
|
|
}
|
|
QGroupBox::title {
|
|
subcontrol-origin: margin;
|
|
subcontrol-position: top left;
|
|
top: 7px;
|
|
left: 12px;
|
|
background: transparent;
|
|
padding: 0 0 0 0;
|
|
color: #CCCCCC;
|
|
font-size: 12px;
|
|
}
|
|
QLabel {
|
|
background: transparent;
|
|
border: none;
|
|
padding: 0;
|
|
}
|
|
QPushButton, QComboBox, QLineEdit, QSpinBox, QDoubleSpinBox, QPlainTextEdit, QListWidget, QTableWidget {
|
|
background: #1F1F1F;
|
|
border: 1px solid #3C3C3C;
|
|
border-radius: 3px;
|
|
padding: 7px 10px;
|
|
selection-background-color: #094771;
|
|
selection-color: #FFFFFF;
|
|
}
|
|
QPushButton:hover, QComboBox:hover, QLineEdit:hover, QSpinBox:hover, QDoubleSpinBox:hover {
|
|
border-color: #007ACC;
|
|
}
|
|
QPushButton {
|
|
background: #2D2D30;
|
|
min-height: 32px;
|
|
}
|
|
QPushButton:checked {
|
|
background: #094771;
|
|
color: #FFFFFF;
|
|
border-color: #007ACC;
|
|
}
|
|
QComboBox::drop-down {
|
|
border: none;
|
|
width: 24px;
|
|
}
|
|
QListWidget::item {
|
|
padding: 6px 8px;
|
|
border-radius: 2px;
|
|
margin: 1px 0;
|
|
}
|
|
QListWidget::item:selected {
|
|
background: #094771;
|
|
border: 1px solid #007ACC;
|
|
}
|
|
QHeaderView::section {
|
|
background: #2D2D30;
|
|
color: #CCCCCC;
|
|
border: none;
|
|
border-right: 1px solid #3C3C3C;
|
|
padding: 6px 8px;
|
|
}
|
|
QTabWidget::pane {
|
|
border: 1px solid #3C3C3C;
|
|
border-radius: 0;
|
|
top: -1px;
|
|
}
|
|
QTabBar::tab {
|
|
background: #2D2D30;
|
|
border: 1px solid #3C3C3C;
|
|
border-bottom: none;
|
|
padding: 8px 14px;
|
|
margin-right: 2px;
|
|
border-top-left-radius: 3px;
|
|
border-top-right-radius: 3px;
|
|
}
|
|
QTabBar::tab:selected {
|
|
background: #1E1E1E;
|
|
color: #FFFFFF;
|
|
}
|
|
QScrollBar:vertical {
|
|
background: #252526;
|
|
width: 12px;
|
|
}
|
|
QScrollBar::handle:vertical {
|
|
background: #424242;
|
|
border-radius: 6px;
|
|
min-height: 30px;
|
|
}
|
|
QScrollBar::handle:vertical:hover {
|
|
background: #4F4F4F;
|
|
}
|
|
QSplitter::handle {
|
|
background: #2D2D30;
|
|
}
|
|
"""
|
|
)
|