"""Application-wide Qt palette and stylesheet configuration.""" from __future__ import annotations from PyQt6.QtGui import QColor, QPalette from PyQt6.QtWidgets import QApplication, QStyleFactory _LIGHT_STYLESHEET = """ QMainWindow, QDialog { background-color: #f3f6fb; } QWidget { color: #1f2937; font-size: 13px; } QGroupBox { background-color: #ffffff; border: 1px solid #d7dee8; border-radius: 10px; margin-top: 14px; padding: 10px; } QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 6px; color: #526277; font-weight: 600; } QPushButton { background-color: #f8fafc; border: 1px solid #cad4e1; border-radius: 8px; padding: 7px 12px; } QPushButton:hover { background-color: #eef3f9; } QPushButton:pressed { background-color: #e4ebf4; } QPushButton:checked { background-color: #2f7ee6; border-color: #2f7ee6; color: #ffffff; } QPushButton:checked:hover { background-color: #3b8bf4; } QPushButton:disabled { color: #98a4b3; background-color: #f3f5f8; border-color: #dde4ec; } QPushButton#settingsToggleButton { min-width: 26px; max-width: 26px; padding: 6px 0px; border-radius: 7px; font-weight: 700; } QPushButton#sectionToggleButton { min-width: 84px; padding: 5px 10px; border-radius: 7px; } QLineEdit, QPlainTextEdit, QTextEdit, QComboBox, QSpinBox, QDoubleSpinBox { background-color: #ffffff; border: 1px solid #c9d4e1; border-radius: 7px; padding: 5px 8px; selection-background-color: #cfe3ff; } QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus, QComboBox:focus, QSpinBox:focus, QDoubleSpinBox:focus { border: 1px solid #2f7ee6; } QTextEdit#runtimeLogBox { font-family: "DejaVu Sans Mono"; font-size: 12px; padding: 6px 8px; } QComboBox::drop-down { border: none; width: 18px; } QScrollArea { border: none; background: transparent; } QLabel#statusLabel { color: #35507a; font-weight: 600; padding: 2px 1px; } QLabel#hintLabel { color: #6c7b8d; } """ def apply_light_theme(app: QApplication) -> None: """Apply a minimal light theme shared by all windows.""" app.setStyle(QStyleFactory.create("Fusion")) palette = QPalette() palette.setColor(QPalette.ColorRole.Window, QColor("#f3f6fb")) palette.setColor(QPalette.ColorRole.WindowText, QColor("#1f2937")) palette.setColor(QPalette.ColorRole.Base, QColor("#ffffff")) palette.setColor(QPalette.ColorRole.AlternateBase, QColor("#eef3f8")) palette.setColor(QPalette.ColorRole.ToolTipBase, QColor("#ffffff")) palette.setColor(QPalette.ColorRole.ToolTipText, QColor("#1f2937")) palette.setColor(QPalette.ColorRole.Text, QColor("#1f2937")) palette.setColor(QPalette.ColorRole.Button, QColor("#f8fafc")) palette.setColor(QPalette.ColorRole.ButtonText, QColor("#1f2937")) palette.setColor(QPalette.ColorRole.BrightText, QColor("#ffffff")) palette.setColor(QPalette.ColorRole.Link, QColor("#2f7ee6")) palette.setColor(QPalette.ColorRole.Highlight, QColor("#2f7ee6")) palette.setColor(QPalette.ColorRole.HighlightedText, QColor("#ffffff")) app.setPalette(palette) app.setStyleSheet(_LIGHT_STYLESHEET)