126 lines
2.8 KiB
Python
126 lines
2.8 KiB
Python
"""Application-wide Qt palette and stylesheet configuration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from PyQt6.QtGui import QColor, QPalette
|
|
from PyQt6.QtWidgets import QApplication, QStyleFactory
|
|
|
|
|
|
_DARK_STYLESHEET = """
|
|
QMainWindow, QDialog {
|
|
background-color: #0f131a;
|
|
}
|
|
|
|
QWidget {
|
|
color: #e7edf7;
|
|
font-size: 13px;
|
|
}
|
|
|
|
QGroupBox {
|
|
background-color: #151b24;
|
|
border: 1px solid #263142;
|
|
border-radius: 10px;
|
|
margin-top: 14px;
|
|
padding: 10px;
|
|
}
|
|
|
|
QGroupBox::title {
|
|
subcontrol-origin: margin;
|
|
left: 10px;
|
|
padding: 0 6px;
|
|
color: #9fb4ce;
|
|
font-weight: 600;
|
|
}
|
|
|
|
QPushButton {
|
|
background-color: #1d2735;
|
|
border: 1px solid #314055;
|
|
border-radius: 8px;
|
|
padding: 7px 12px;
|
|
}
|
|
|
|
QPushButton:hover {
|
|
background-color: #243246;
|
|
}
|
|
|
|
QPushButton:pressed {
|
|
background-color: #1a2432;
|
|
}
|
|
|
|
QPushButton:disabled {
|
|
color: #6b7d95;
|
|
background-color: #151d27;
|
|
border-color: #232e3d;
|
|
}
|
|
|
|
QPushButton#settingsToggleButton {
|
|
min-width: 26px;
|
|
max-width: 26px;
|
|
padding: 6px 0px;
|
|
border-radius: 7px;
|
|
font-weight: 700;
|
|
}
|
|
|
|
QLineEdit,
|
|
QPlainTextEdit,
|
|
QComboBox,
|
|
QSpinBox,
|
|
QDoubleSpinBox {
|
|
background-color: #101721;
|
|
border: 1px solid #2e3b4e;
|
|
border-radius: 7px;
|
|
padding: 5px 8px;
|
|
selection-background-color: #2f7ee6;
|
|
}
|
|
|
|
QLineEdit:focus,
|
|
QPlainTextEdit:focus,
|
|
QComboBox:focus,
|
|
QSpinBox:focus,
|
|
QDoubleSpinBox:focus {
|
|
border: 1px solid #5d88bd;
|
|
}
|
|
|
|
QComboBox::drop-down {
|
|
border: none;
|
|
width: 18px;
|
|
}
|
|
|
|
QScrollArea {
|
|
border: none;
|
|
background: transparent;
|
|
}
|
|
|
|
QLabel#statusLabel {
|
|
color: #94b4d9;
|
|
font-weight: 600;
|
|
padding: 2px 1px;
|
|
}
|
|
|
|
QLabel#hintLabel {
|
|
color: #7f94af;
|
|
}
|
|
"""
|
|
|
|
|
|
def apply_dark_theme(app: QApplication) -> None:
|
|
"""Apply a minimal modern dark theme shared by all windows."""
|
|
app.setStyle(QStyleFactory.create("Fusion"))
|
|
|
|
palette = QPalette()
|
|
palette.setColor(QPalette.ColorRole.Window, QColor("#0f131a"))
|
|
palette.setColor(QPalette.ColorRole.WindowText, QColor("#e7edf7"))
|
|
palette.setColor(QPalette.ColorRole.Base, QColor("#101721"))
|
|
palette.setColor(QPalette.ColorRole.AlternateBase, QColor("#151b24"))
|
|
palette.setColor(QPalette.ColorRole.ToolTipBase, QColor("#151b24"))
|
|
palette.setColor(QPalette.ColorRole.ToolTipText, QColor("#e7edf7"))
|
|
palette.setColor(QPalette.ColorRole.Text, QColor("#e7edf7"))
|
|
palette.setColor(QPalette.ColorRole.Button, QColor("#1d2735"))
|
|
palette.setColor(QPalette.ColorRole.ButtonText, QColor("#e7edf7"))
|
|
palette.setColor(QPalette.ColorRole.BrightText, QColor("#ffffff"))
|
|
palette.setColor(QPalette.ColorRole.Link, QColor("#5d88bd"))
|
|
palette.setColor(QPalette.ColorRole.Highlight, QColor("#2f7ee6"))
|
|
palette.setColor(QPalette.ColorRole.HighlightedText, QColor("#ffffff"))
|
|
app.setPalette(palette)
|
|
app.setStyleSheet(_DARK_STYLESHEET)
|