feat: add FS25_FarmHUD mod and FarmHUD desktop companion app
Initial commit: the FS25 Lua mod (live.json data export), the FS25-WebDashboard project (Node/web dashboard + PySide6 desktop variant), and FarmHUD (standalone PySide6 companion app with Discord Rich Presence, settings, and installer).
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
"""Light/dark theme colors + Qt stylesheet, persisted like the web version's
|
||||
`localStorage` theme key (via QSettings this time).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from PySide6.QtCore import QSettings
|
||||
|
||||
SETTINGS_ORG = "FS25WebDashboard"
|
||||
SETTINGS_APP = "DesktopDashboard"
|
||||
THEME_KEY = "theme"
|
||||
|
||||
DARK = {
|
||||
"bg": "#12161c",
|
||||
"panel": "#1b212b",
|
||||
"panel-header": "#222a36",
|
||||
"border": "#2b3442",
|
||||
"text": "#e7ecf3",
|
||||
"text-dim": "#8b97a8",
|
||||
"accent": "#4da3ff",
|
||||
"accent-rpm": "#ff9f4d",
|
||||
"danger": "#ff5d5d",
|
||||
"ok": "#3ecf7a",
|
||||
"warn": "#e8b93f",
|
||||
"track": "#2b3442",
|
||||
}
|
||||
|
||||
LIGHT = {
|
||||
"bg": "#f2f4f7",
|
||||
"panel": "#ffffff",
|
||||
"panel-header": "#eef1f5",
|
||||
"border": "#dbe1e8",
|
||||
"text": "#1a2230",
|
||||
"text-dim": "#5c6a7d",
|
||||
"accent": "#1c6fe0",
|
||||
"accent-rpm": "#e07a1c",
|
||||
"danger": "#d3392f",
|
||||
"ok": "#1f9d55",
|
||||
"warn": "#b8860b",
|
||||
"track": "#e2e7ed",
|
||||
}
|
||||
|
||||
|
||||
def load_theme_name() -> str:
|
||||
settings = QSettings(SETTINGS_ORG, SETTINGS_APP)
|
||||
return settings.value(THEME_KEY, "dark")
|
||||
|
||||
|
||||
def save_theme_name(name: str) -> None:
|
||||
settings = QSettings(SETTINGS_ORG, SETTINGS_APP)
|
||||
settings.setValue(THEME_KEY, name)
|
||||
|
||||
|
||||
def colors_for(name: str) -> dict:
|
||||
return DARK if name != "light" else LIGHT
|
||||
|
||||
|
||||
def build_stylesheet(name: str) -> str:
|
||||
c = colors_for(name)
|
||||
return f"""
|
||||
QWidget {{
|
||||
background: {c['bg']};
|
||||
color: {c['text']};
|
||||
font-size: 13px;
|
||||
}}
|
||||
QMainWindow, QScrollArea, QScrollArea > QWidget > QWidget {{
|
||||
background: {c['bg']};
|
||||
}}
|
||||
QGroupBox {{
|
||||
background: {c['panel']};
|
||||
border: 1px solid {c['border']};
|
||||
border-radius: 8px;
|
||||
margin-top: 0px;
|
||||
padding: 0px;
|
||||
}}
|
||||
QFrame[role="panel"] {{
|
||||
background: {c['panel']};
|
||||
border: 1px solid {c['border']};
|
||||
border-radius: 8px;
|
||||
}}
|
||||
QLabel {{
|
||||
background: transparent;
|
||||
}}
|
||||
QLabel[role="panel-title"] {{
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
background: transparent;
|
||||
}}
|
||||
QLabel[role="panel-sub"], QLabel[role="stat-label"] {{
|
||||
color: {c['text-dim']};
|
||||
font-size: 11px;
|
||||
}}
|
||||
QLabel[role="stat-value"] {{
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}}
|
||||
QFrame[role="panel-header"] {{
|
||||
background: {c['panel-header']};
|
||||
border-top-left-radius: 8px;
|
||||
border-top-right-radius: 8px;
|
||||
border-bottom: 1px solid {c['border']};
|
||||
}}
|
||||
QFrame[role="stat-chip"] {{
|
||||
background: {c['panel-header']};
|
||||
border: 1px solid {c['border']};
|
||||
border-radius: 6px;
|
||||
}}
|
||||
QPushButton {{
|
||||
background: {c['panel-header']};
|
||||
border: 1px solid {c['border']};
|
||||
border-radius: 6px;
|
||||
padding: 4px 10px;
|
||||
color: {c['text']};
|
||||
}}
|
||||
QPushButton:hover {{
|
||||
border-color: {c['accent']};
|
||||
}}
|
||||
QPushButton[active="true"] {{
|
||||
border-color: {c['accent']};
|
||||
color: {c['accent']};
|
||||
}}
|
||||
QPushButton[flat="true"] {{
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: {c['text-dim']};
|
||||
}}
|
||||
QProgressBar {{
|
||||
background: {c['track']};
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
color: {c['text']};
|
||||
height: 10px;
|
||||
}}
|
||||
QProgressBar::chunk {{
|
||||
border-radius: 4px;
|
||||
}}
|
||||
QTableWidget {{
|
||||
background: {c['panel']};
|
||||
gridline-color: {c['border']};
|
||||
border: none;
|
||||
selection-background-color: {c['accent']};
|
||||
}}
|
||||
QHeaderView::section {{
|
||||
background: {c['panel-header']};
|
||||
color: {c['text-dim']};
|
||||
border: none;
|
||||
border-bottom: 1px solid {c['border']};
|
||||
padding: 4px;
|
||||
}}
|
||||
QScrollBar:vertical {{
|
||||
background: {c['bg']};
|
||||
width: 12px;
|
||||
}}
|
||||
QScrollBar::handle:vertical {{
|
||||
background: {c['border']};
|
||||
border-radius: 6px;
|
||||
min-height: 24px;
|
||||
}}
|
||||
"""
|
||||
Reference in New Issue
Block a user