157 lines
3.2 KiB
Python
157 lines
3.2 KiB
Python
"""Shared Qt theme for the laser-control desktop UI."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from PyQt6.QtGui import QColor, QPalette
|
|
from PyQt6.QtWidgets import QApplication, QStyleFactory
|
|
|
|
|
|
_STYLESHEET = """
|
|
QMainWindow {
|
|
background-color: #edf2f7;
|
|
}
|
|
|
|
QWidget {
|
|
color: #17212b;
|
|
font-size: 13px;
|
|
}
|
|
|
|
QGroupBox {
|
|
background-color: #ffffff;
|
|
border: 1px solid #d8e0ea;
|
|
border-radius: 14px;
|
|
margin-top: 14px;
|
|
padding: 12px;
|
|
}
|
|
|
|
QGroupBox::title {
|
|
subcontrol-origin: margin;
|
|
left: 12px;
|
|
padding: 0 6px;
|
|
color: #506274;
|
|
font-weight: 600;
|
|
}
|
|
|
|
QPushButton {
|
|
background-color: #f7fafc;
|
|
border: 1px solid #c8d3df;
|
|
border-radius: 8px;
|
|
padding: 7px 12px;
|
|
}
|
|
|
|
QPushButton:hover {
|
|
background-color: #edf3f9;
|
|
}
|
|
|
|
QPushButton:pressed {
|
|
background-color: #e2ebf4;
|
|
}
|
|
|
|
QPushButton#primaryButton {
|
|
background-color: #1f6feb;
|
|
border-color: #1f6feb;
|
|
color: #ffffff;
|
|
font-weight: 600;
|
|
}
|
|
|
|
QPushButton#primaryButton:hover {
|
|
background-color: #2b7bf7;
|
|
}
|
|
|
|
QPushButton:disabled {
|
|
color: #95a3b3;
|
|
background-color: #f3f6f9;
|
|
border-color: #dde5ee;
|
|
}
|
|
|
|
QLabel#captionLabel {
|
|
color: #6b7b8d;
|
|
}
|
|
|
|
QLabel#valueLabel {
|
|
color: #1f2937;
|
|
font-weight: 600;
|
|
}
|
|
|
|
QLabel#statusOk {
|
|
color: #156f3d;
|
|
font-weight: 700;
|
|
}
|
|
|
|
QLabel#statusError {
|
|
color: #b42318;
|
|
font-weight: 700;
|
|
}
|
|
|
|
QDoubleSpinBox,
|
|
QSpinBox,
|
|
QComboBox,
|
|
QLineEdit,
|
|
QTextEdit,
|
|
QPlainTextEdit {
|
|
background-color: #ffffff;
|
|
border: 1px solid #c8d3df;
|
|
border-radius: 8px;
|
|
padding: 5px 8px;
|
|
}
|
|
|
|
QDoubleSpinBox:focus,
|
|
QSpinBox:focus,
|
|
QComboBox:focus,
|
|
QLineEdit:focus,
|
|
QTextEdit:focus,
|
|
QPlainTextEdit:focus {
|
|
border: 1px solid #1f6feb;
|
|
}
|
|
|
|
QTextEdit#logBox,
|
|
QPlainTextEdit {
|
|
font-family: "DejaVu Sans Mono";
|
|
font-size: 12px;
|
|
background-color: #fbfdff;
|
|
}
|
|
|
|
QTabWidget::pane {
|
|
border: 1px solid #d8e0ea;
|
|
border-radius: 10px;
|
|
background-color: #f8fbfe;
|
|
top: -1px;
|
|
}
|
|
|
|
QTabBar::tab {
|
|
background-color: #eef4fa;
|
|
border: 1px solid #d8e0ea;
|
|
border-bottom: none;
|
|
padding: 7px 12px;
|
|
margin-right: 4px;
|
|
border-top-left-radius: 8px;
|
|
border-top-right-radius: 8px;
|
|
}
|
|
|
|
QTabBar::tab:selected {
|
|
background-color: #f8fbfe;
|
|
color: #1f2937;
|
|
font-weight: 600;
|
|
}
|
|
"""
|
|
|
|
|
|
def apply_theme(app: QApplication) -> None:
|
|
"""Apply a light desktop theme aligned with the radar_system UI style."""
|
|
app.setStyle(QStyleFactory.create("Fusion"))
|
|
|
|
palette = QPalette()
|
|
palette.setColor(QPalette.ColorRole.Window, QColor("#edf2f7"))
|
|
palette.setColor(QPalette.ColorRole.WindowText, QColor("#17212b"))
|
|
palette.setColor(QPalette.ColorRole.Base, QColor("#ffffff"))
|
|
palette.setColor(QPalette.ColorRole.AlternateBase, QColor("#f6f9fc"))
|
|
palette.setColor(QPalette.ColorRole.ToolTipBase, QColor("#ffffff"))
|
|
palette.setColor(QPalette.ColorRole.ToolTipText, QColor("#17212b"))
|
|
palette.setColor(QPalette.ColorRole.Text, QColor("#17212b"))
|
|
palette.setColor(QPalette.ColorRole.Button, QColor("#f7fafc"))
|
|
palette.setColor(QPalette.ColorRole.ButtonText, QColor("#17212b"))
|
|
palette.setColor(QPalette.ColorRole.Highlight, QColor("#1f6feb"))
|
|
palette.setColor(QPalette.ColorRole.HighlightedText, QColor("#ffffff"))
|
|
app.setPalette(palette)
|
|
app.setStyleSheet(_STYLESHEET)
|